toolboxv2 API Reference¶
This section provides an API reference for key components directly available from the toolboxv2 package.
Core Application & Tooling¶
toolboxv2.AppType
¶
Source code in toolboxv2/utils/system/types.py
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
debug
property
writable
¶
proxi attr
a_exit()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2080 2081 | |
a_fuction_runner(function, function_data, args, kwargs)
async
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2145 2146 2147 2148 2149 2150 2151 2152 2153 | |
a_remove_mod(mod_name, spec='app', delete=True)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2071 2072 | |
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2173 2174 2175 2176 2177 2178 | |
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
debug_rains(e)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1964 1965 | |
disconnect(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1952 1953 1954 | |
docs_init(force_rebuild=False)
async
¶
mkdocs system [extra] Returns:
Source code in toolboxv2/utils/system/types.py
2427 2428 2429 2430 2431 | |
docs_lookup(name=None, element_type=None, file_path=None, language=None, include_code=False, max_results=25)
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2410 2411 2412 2413 2414 2415 2416 2417 2418 | |
docs_reader(query=None, section_id=None, file_path=None, tags=None, max_results=25, format_type='structured')
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | |
docs_suggestions(max_suggestions=20)
async
¶
mkdocs system [extra] Returns: {"suggestions": [{"type": "unclear_section", "section_id": "123", "title": "Section Title", "priority": "low"}, ...], "total": 100, "time_ms": 123}
Source code in toolboxv2/utils/system/types.py
2419 2420 2421 2422 2423 | |
docs_sync()
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2425 2426 | |
docs_writer(action, **kwargs)
async
¶
"mkdocs system [extra] Actions: - create_file Kwargs: file_path, content Returns: {"status": "created", "file": file_path, "sections": num_sections} - add_section Kwargs: file_path, section_title, content, position, level Returns: {"status": "added", "section": section_id} - update_section Kwargs: section_id, content Returns: {"status": "updated", "section": section_id} - delete_section Kwargs: section_id Returns: {"status": "deleted", "section": section_id}
on error
Returns: {"error": "error_message"}
Source code in toolboxv2/utils/system/types.py
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | |
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶
Execute all functions with parallel processing and optional profiling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | |
exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2074 2075 | |
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1940 1941 1942 | |
footprint(update_tracking=True)
¶
Erfasst den aktuellen Ressourcen-Footprint der Toolbox-Instanz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update_tracking
|
bool
|
Wenn True, aktualisiert Min/Max/Avg-Tracking |
True
|
Returns:
| Type | Description |
|---|---|
FootprintMetrics
|
FootprintMetrics mit allen erfassten Metriken |
Source code in toolboxv2/utils/system/types.py
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | |
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2135 2136 2137 2138 2139 2140 2141 2142 2143 | |
generate_openapi_html()
¶
Generiert eine HTML-Datei mit OpenAPI/Swagger UI für API-Routen.
Args:
Source code in toolboxv2/utils/system/types.py
2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
get_all_mods(working_dir='mods', path_to='./runtime')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2045 2046 | |
get_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2372 2373 | |
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
2086 2087 2088 2089 2090 2091 2092 2093 2094 | |
get_mod(name, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2180 2181 | |
get_task_context(files, intent)
async
¶
mkdocs system [extra] Get optimized context for a specific editing task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[str]
|
List of file paths relevant to the task. |
required |
intent
|
str
|
Description of what the user wants to do (e.g., "Add logging to auth"). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
ContextBundle dictionary ready for LLM injection. |
Source code in toolboxv2/utils/system/types.py
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 | |
get_username(get_input=False, default='loot')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2375 2376 | |
hide_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1944 1945 1946 | |
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2011 2012 | |
load_all_mods_in_file(working_dir='mods')
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2042 2043 | |
load_external_mods()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2039 2040 | |
load_mod(mod_name, mlm='I', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2033 2034 | |
mod_online(mod_name, installed=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2020 2021 | |
print(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2183 2184 2185 | |
print_footprint(detailed=True)
¶
Gibt den Footprint formatiert aus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detailed
|
bool
|
Wenn True, zeigt alle Details, sonst nur Zusammenfassung |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Formatierter Footprint-String |
Source code in toolboxv2/utils/system/types.py
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | |
print_ok()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2058 2059 2060 | |
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2062 2063 | |
remove_mod(mod_name, spec='app', delete=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2068 2069 | |
rrun_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1973 1974 | |
run_a_from_sync(function, *args)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
2096 2097 2098 2099 | |
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2167 2168 2169 2170 2171 | |
run_bg_task(task)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
2111 2112 2113 2114 | |
run_bg_task_advanced(task, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2101 2102 2103 2104 | |
run_flows(name, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1970 1971 | |
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2115 2116 2117 2118 2119 2120 2121 2122 2123 | |
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶
run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | |
save_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2369 2370 | |
save_exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2030 2031 | |
save_initialized_module(tools_class, spec)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2017 2018 | |
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2014 2015 | |
save_load(modname, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2083 2084 | |
save_registry_as_enums(directory, filename)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2378 2379 | |
set_flows(r)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1967 1968 | |
set_logger(debug=False, logger_prefix=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1956 1957 | |
show_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1948 1949 1950 | |
sprint(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2187 2188 2189 | |
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None, websocket_handler=None, websocket_context=False)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | |
wait_for_bg_tasks(timeout=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2106 2107 2108 2109 | |
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2065 2066 | |
web_context()
¶
returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
2077 2078 | |
toolboxv2.MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
174 175 176 177 178 179 180 | |
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
167 168 169 | |
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
164 165 | |
toolboxv2.get_app(from_=None, name=None, args=AppArgs().default(), app_con=None, sync=False)
¶
Source code in toolboxv2/utils/system/getting_and_closing_app.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
System Utilities & Configuration¶
toolboxv2.FileHandler
¶
Bases: Code
Source code in toolboxv2/utils/system/file_handler.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
toolboxv2.utils
¶
App
¶
Source code in toolboxv2/utils/toolbox.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | |
disconnect(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
248 249 250 | |
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
236 237 238 | |
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/toolbox.py
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | |
hide_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
240 241 242 | |
init_mod(mod_name, spec='app')
¶
Initializes a module in a thread-safe manner by submitting the asynchronous initialization to the running event loop.
Source code in toolboxv2/utils/toolbox.py
647 648 649 650 651 652 653 654 | |
run(*args, mod_function_name=None, request=None, running_function_coro=None, **kwargs)
¶
Run a function with support for SSE streaming in both threaded and non-threaded contexts.
Source code in toolboxv2/utils/toolbox.py
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
run_bg_task(task, *args, **kwargs)
¶
Runs a coroutine in the background without blocking the caller.
This is the primary method for "fire-and-forget" async tasks. It schedules the coroutine to run on the application's main event loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Callable
|
The coroutine function to run. |
required |
*args
|
Arguments to pass to the coroutine function. |
()
|
|
**kwargs
|
Keyword arguments to pass to the coroutine function. |
{}
|
Returns:
| Type | Description |
|---|---|
Task | None
|
An asyncio.Task object representing the scheduled task, or None if |
Task | None
|
the task could not be scheduled. |
Source code in toolboxv2/utils/toolbox.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | |
run_bg_task_advanced(task, *args, get_coro=False, **kwargs)
¶
Runs a task in a separate, dedicated background thread with its own event loop.
This is ideal for: 1. Running an async task from a synchronous context. 2. Launching a long-running, independent operation that should not interfere with the main application's event loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Callable
|
The function to run (can be sync or async). |
required |
*args
|
Arguments for the task. |
()
|
|
**kwargs
|
Keyword arguments for the task. |
{}
|
Returns:
| Type | Description |
|---|---|
Thread
|
The threading.Thread object managing the background execution. |
Source code in toolboxv2/utils/toolbox.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | |
show_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
244 245 246 | |
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, request_as_kwarg=False, row=False, state=None, level=-1, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None, websocket_handler=None, websocket_context=False)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
-1
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
websocket_handler
|
str
|
The name of the websocket handler to use. |
None
|
websocket_context
|
bool
|
Flag to indicate if the function should receive the websocket context. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/toolbox.py
2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | |
wait_for_bg_tasks(timeout=None)
¶
Wait for all background tasks to complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Maximum time to wait (in seconds) for all tasks to complete. None means wait indefinitely. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if all tasks completed, False if timeout occurred |
Source code in toolboxv2/utils/toolbox.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | |
ws_broadcast(channel_id, payload, source_conn_id='python_broadcast')
async
¶
Sendet eine Nachricht asynchron an alle Clients in einem Kanal/Raum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
str
|
Der Kanal, an den gesendet werden soll. |
required |
payload
|
dict
|
Ein Dictionary, das als JSON gesendet wird. |
required |
source_conn_id
|
optional
|
Die ID der ursprünglichen Verbindung, um Echos zu vermeiden. |
'python_broadcast'
|
Source code in toolboxv2/utils/toolbox.py
2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | |
ws_send(conn_id, payload)
async
¶
Sendet eine Nachricht asynchron an eine einzelne WebSocket-Verbindung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn_id
|
str
|
Die eindeutige ID der Zielverbindung. |
required |
payload
|
dict
|
Ein Dictionary, das als JSON gesendet wird. |
required |
Source code in toolboxv2/utils/toolbox.py
2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 | |
Code
¶
Source code in toolboxv2/utils/security/cryp.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
generate_random_string(length)
staticmethod
¶
Generiert eine zufällige Zeichenkette der angegebenen Länge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
Die Länge der zu generierenden Zeichenkette. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Die generierte Zeichenkette. |
Source code in toolboxv2/utils/security/cryp.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
114 115 116 117 118 119 120 121 122 | |
generate_symmetric_key(as_str=True)
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str or bytes
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
433 434 435 436 437 438 439 440 441 442 443 444 445 | |
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
174 175 176 177 178 179 180 | |
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
167 168 169 | |
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
164 165 | |
Result
¶
Source code in toolboxv2/utils/system/types.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__class_getitem__(item)
¶
Enable Result[Type] syntax
Source code in toolboxv2/utils/system/types.py
734 735 736 737 738 739 740 741 742 743 744 | |
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
cast_to(target_type)
¶
Cast result to different type
Source code in toolboxv2/utils/system/types.py
829 830 831 832 833 834 835 836 837 838 839 | |
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
| Type | Description |
|---|---|
|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | |
get_type_info()
¶
Get the generic type information
Source code in toolboxv2/utils/system/types.py
841 842 843 | |
is_typed()
¶
Check if result has type information
Source code in toolboxv2/utils/system/types.py
845 846 847 | |
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | |
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
| Type | Description |
|---|---|
|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
dict | None
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional function for cleanup. |
None
|
Returns:
| Type | Description |
|---|---|
|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
typed_aget(key=None, default=None)
async
¶
Async get data with type validation
Source code in toolboxv2/utils/system/types.py
758 759 760 761 762 763 764 765 766 767 | |
typed_get(key=None, default=None)
¶
Get data with type validation
Source code in toolboxv2/utils/system/types.py
746 747 748 749 750 751 752 753 754 755 756 | |
typed_json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create JSON result with type information
Source code in toolboxv2/utils/system/types.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
typed_ok(data, data_info='', info='OK', interface=ToolBoxInterfaces.native)
classmethod
¶
Create OK result with type information
Source code in toolboxv2/utils/system/types.py
796 797 798 799 800 801 802 803 804 805 806 807 | |
Singleton
¶
Singleton metaclass for ensuring only one instance of a class.
Source code in toolboxv2/utils/singelton_class.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
__enter__()
¶
Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
652 653 654 655 656 657 | |
__exit__(exc_type, exc_value, exc_traceback)
¶
Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
659 660 661 662 663 664 665 666 | |
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶
Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
TBEF
¶
Automatic generated by ToolBox v = 0.1.22
clis
¶
cli_printing
¶
Colors
¶
ANSI color codes for terminal styling
Source code in toolboxv2/utils/clis/cli_printing.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
c_print(*args, **kwargs)
¶
Safe print with Unicode error handling.
Source code in toolboxv2/utils/clis/cli_printing.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
main()
¶
Entry point for running visual test directly
Source code in toolboxv2/utils/clis/cli_printing.py
456 457 458 | |
print_box_content(text, style='', width=76, auto_wrap=True)
¶
Print content with minimal styled prefix
Source code in toolboxv2/utils/clis/cli_printing.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
print_box_footer(width=76)
¶
Print a minimal footer
Source code in toolboxv2/utils/clis/cli_printing.py
155 156 157 | |
print_box_header(title, icon='ℹ', width=76)
¶
Print a minimal styled header
Source code in toolboxv2/utils/clis/cli_printing.py
148 149 150 151 152 | |
print_code_block(code, language='text', width=76, show_line_numbers=False)
¶
Print code block with minimal syntax highlighting
Source code in toolboxv2/utils/clis/cli_printing.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
print_separator(char='─', width=76)
¶
Print a minimal separator line
Source code in toolboxv2/utils/clis/cli_printing.py
273 274 275 | |
print_status(message, status='info')
¶
Print a minimal status message with icon and color
Source code in toolboxv2/utils/clis/cli_printing.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
print_table_header(columns, widths)
¶
Print a table header with columns
Source code in toolboxv2/utils/clis/cli_printing.py
280 281 282 283 284 285 286 287 288 289 | |
print_table_row(values, widths, styles=None)
¶
Print a table row
Source code in toolboxv2/utils/clis/cli_printing.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
run_visual_test()
¶
Visual test for all UI components - for alignment and testing
Source code in toolboxv2/utils/clis/cli_printing.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
cli_worker_manager
¶
cli_worker_manager.py - Complete Worker Manager for ToolBoxV2
Cross-Platform (Windows/Linux/macOS) Worker Orchestration: - Nginx installation and high-performance configuration - HTTP and WebSocket worker processes - ZeroMQ event broker with real metrics - Zero-downtime rolling updates - Cluster mode with remote workers - SSL auto-discovery (Let's Encrypt) - Health monitoring with active probing - Minimal web UI - CLI interface
HealthChecker
¶
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 | |
MetricsCollector
¶
Collect metrics from workers via: - HTTP /metrics endpoint (for HTTP workers) - ZMQ HEALTH_CHECK events (for WS workers)
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 | |
get_all_metrics()
¶Get all worker metrics.
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1702 1703 1704 1705 | |
get_metrics(worker_id)
¶Get metrics for a specific worker.
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1697 1698 1699 1700 | |
start(workers)
¶Start metrics collection.
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1570 1571 1572 1573 1574 1575 1576 1577 | |
stop()
¶Stop metrics collection.
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 | |
update_workers(workers)
¶Update worker reference.
Source code in toolboxv2/utils/clis/cli_worker_manager.py
1593 1594 1595 | |
NginxManager
¶
Source code in toolboxv2/utils/clis/cli_worker_manager.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 | |
generate_config(http_ports, ws_ports, http_sockets=None, ws_sockets=None, remote_nodes=None)
¶Generate Nginx configuration for ToolBoxV2 worker system.
Features: - HTTP/WS upstream load balancing - Auth endpoint routing (secured) - API endpoint routing with access control - Unix socket support (Linux/macOS) - Rate limiting (different zones for auth/api) - Static file serving from dist/ - SSL/TLS support - Gzip compression - WebSocket proxying with session auth - SSE streaming support
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_ports
|
List[int]
|
List of HTTP worker ports |
required |
ws_ports
|
List[int]
|
List of WebSocket worker ports |
required |
http_sockets
|
List[str]
|
Optional Unix socket paths for HTTP workers |
None
|
ws_sockets
|
List[str]
|
Optional Unix socket paths for WS workers |
None
|
remote_nodes
|
List[Tuple[str, int]]
|
Optional list of (host, port) tuples for remote backends |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Complete nginx.conf content as string |
Source code in toolboxv2/utils/clis/cli_worker_manager.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
db_cli_manager
¶
ClusterConfig
dataclass
¶
Configuration for a MinIO cluster/setup
Source code in toolboxv2/utils/clis/db_cli_manager.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
MinIOCLIManager
¶
CLI Manager for MinIO installations and configurations
Source code in toolboxv2/utils/clis/db_cli_manager.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | |
cmd_health(name=None)
¶Health check for instance(s)
Source code in toolboxv2/utils/clis/db_cli_manager.py
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | |
cmd_info()
¶Show system and installation info
Source code in toolboxv2/utils/clis/db_cli_manager.py
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | |
cmd_install(components=None)
¶Install MinIO components
Source code in toolboxv2/utils/clis/db_cli_manager.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
cmd_list_buckets(name)
¶List buckets in an instance
Source code in toolboxv2/utils/clis/db_cli_manager.py
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
cmd_restart(name)
¶Restart a MinIO instance
Source code in toolboxv2/utils/clis/db_cli_manager.py
786 787 788 789 790 791 792 793 794 | |
cmd_setup_desktop(name='local', cloud_endpoint=None, cloud_access_key=None, cloud_secret_key=None, auto_sync=True)
¶Setup a desktop client with local MinIO and optional cloud sync
Source code in toolboxv2/utils/clis/db_cli_manager.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
cmd_setup_mobile(name='mobile', cloud_endpoint=None, cloud_access_key=None, cloud_secret_key=None, max_size_mb=500)
¶Setup mobile SQLite database for offline storage
Source code in toolboxv2/utils/clis/db_cli_manager.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
cmd_setup_replication(source, target)
¶Setup server-to-server replication
Source code in toolboxv2/utils/clis/db_cli_manager.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
cmd_setup_server(name='cloud', port=9000, access_key=None, secret_key=None, host='0.0.0.0', use_docker=False)
¶Setup a central cloud server
Source code in toolboxv2/utils/clis/db_cli_manager.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
cmd_start(name=None)
¶Start MinIO instance(s)
Source code in toolboxv2/utils/clis/db_cli_manager.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | |
cmd_status(name=None)
¶Show status of instance(s)
Source code in toolboxv2/utils/clis/db_cli_manager.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | |
cmd_stop(name=None)
¶Stop MinIO instance(s)
Source code in toolboxv2/utils/clis/db_cli_manager.py
768 769 770 771 772 773 774 775 776 777 778 779 780 | |
cmd_stop_all()
¶Stop all instances
Source code in toolboxv2/utils/clis/db_cli_manager.py
782 783 784 | |
cmd_sync(name)
¶Trigger manual sync for mobile/desktop
Source code in toolboxv2/utils/clis/db_cli_manager.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | |
cmd_uninstall()
¶Uninstall MinIO
Source code in toolboxv2/utils/clis/db_cli_manager.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
cli_db_runner()
async
¶
Main CLI entry point
Source code in toolboxv2/utils/clis/db_cli_manager.py
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | |
minio_user_manager
¶
ToolBox V2 - MinIO User Manager Verwaltet MinIO IAM Users und Policies für Multi-User Blob Storage
Features: - Erstellt MinIO Users mit User-spezifischen Credentials - Generiert Scope-basierte IAM Policies - Integration mit Clerk Auth - Credential-Rotation
MinIOAdminClient
¶
Wrapper für MinIO Admin Operationen via mc CLI
Requires: mc (MinIO Client) installed and configured
Source code in toolboxv2/utils/clis/minio_user_manager.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
__init__(alias='local', mc_path=None)
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias
|
str
|
MinIO Alias in mc config (z.B. "local", "cloud") |
'local'
|
mc_path
|
str
|
Pfad zur mc Binary |
None
|
Source code in toolboxv2/utils/clis/minio_user_manager.py
164 165 166 167 168 169 170 171 172 173 174 | |
attach_policy(policy_name, user_access_key)
¶Weist User eine Policy zu
Source code in toolboxv2/utils/clis/minio_user_manager.py
312 313 314 315 316 317 318 319 320 321 | |
bucket_exists(bucket)
¶Prüft ob Bucket existiert
Source code in toolboxv2/utils/clis/minio_user_manager.py
344 345 346 347 | |
create_bucket(bucket)
¶Erstellt Bucket
Source code in toolboxv2/utils/clis/minio_user_manager.py
336 337 338 339 340 341 342 | |
create_policy(name, policy_json)
¶Erstellt MinIO Policy
Source code in toolboxv2/utils/clis/minio_user_manager.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
create_user(access_key, secret_key)
¶Erstellt MinIO User
Source code in toolboxv2/utils/clis/minio_user_manager.py
217 218 219 220 221 222 223 224 225 | |
delete_policy(name)
¶Löscht MinIO Policy
Source code in toolboxv2/utils/clis/minio_user_manager.py
288 289 290 291 292 293 294 | |
delete_user(access_key)
¶Löscht MinIO User
Source code in toolboxv2/utils/clis/minio_user_manager.py
227 228 229 230 231 232 233 | |
detach_policy(policy_name, user_access_key)
¶Entfernt Policy von User
Source code in toolboxv2/utils/clis/minio_user_manager.py
323 324 325 326 327 328 329 330 331 332 | |
list_policies()
¶Listet alle Policies
Source code in toolboxv2/utils/clis/minio_user_manager.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
list_users()
¶Listet alle MinIO Users
Source code in toolboxv2/utils/clis/minio_user_manager.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
set_bucket_policy(bucket, policy)
¶Setzt Bucket-Level Policy
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
str
|
"none", "download", "upload", "public" |
required |
Source code in toolboxv2/utils/clis/minio_user_manager.py
349 350 351 352 353 354 355 356 357 358 359 360 | |
set_user_status(access_key, enabled)
¶Aktiviert/Deaktiviert User
Source code in toolboxv2/utils/clis/minio_user_manager.py
255 256 257 258 259 260 261 262 | |
user_exists(access_key)
¶Prüft ob User existiert
Source code in toolboxv2/utils/clis/minio_user_manager.py
251 252 253 | |
MinIOUserCredentials
dataclass
¶
MinIO User Credentials
Source code in toolboxv2/utils/clis/minio_user_manager.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
MinIOUserManager
¶
Verwaltet MinIO Users und deren Credentials
Features: - Erstellt User mit Scope-basierten Policies - Speichert Credentials verschlüsselt - Credential Rotation - Integration mit Clerk Auth
Source code in toolboxv2/utils/clis/minio_user_manager.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
create_user(user_id, scopes=None)
¶Erstellt MinIO User für Clerk User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
scopes
|
List[Scope]
|
Erlaubte Scopes (default: alle außer SERVER) |
None
|
Returns:
| Type | Description |
|---|---|
MinIOUserCredentials
|
MinIOUserCredentials mit Access/Secret Key |
Source code in toolboxv2/utils/clis/minio_user_manager.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
delete_user(user_id)
¶Löscht MinIO User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True wenn erfolgreich |
Source code in toolboxv2/utils/clis/minio_user_manager.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
get_credentials(user_id)
¶Holt Credentials für User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
Returns:
| Type | Description |
|---|---|
Optional[MinIOUserCredentials]
|
MinIOUserCredentials oder None |
Source code in toolboxv2/utils/clis/minio_user_manager.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
get_or_create_credentials(user_id, scopes=None)
¶Holt oder erstellt Credentials
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
scopes
|
List[Scope]
|
Scopes für neuen User |
None
|
Returns:
| Type | Description |
|---|---|
MinIOUserCredentials
|
MinIOUserCredentials |
Source code in toolboxv2/utils/clis/minio_user_manager.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
rotate_credentials(user_id)
¶Rotiert Secret Key für User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
Returns:
| Type | Description |
|---|---|
Optional[MinIOUserCredentials]
|
Neue Credentials |
Source code in toolboxv2/utils/clis/minio_user_manager.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
update_scopes(user_id, scopes)
¶Aktualisiert Scopes für User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Clerk User ID |
required |
scopes
|
List[Scope]
|
Neue Liste von Scopes |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True wenn erfolgreich |
Source code in toolboxv2/utils/clis/minio_user_manager.py
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | |
ScopePolicy
dataclass
¶
IAM Policy für einen Scope
Source code in toolboxv2/utils/clis/minio_user_manager.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
to_minio_policy(user_id=None)
¶Generiert MinIO Policy JSON
Source code in toolboxv2/utils/clis/minio_user_manager.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
main()
¶
CLI für User Management
Source code in toolboxv2/utils/clis/minio_user_manager.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | |
setup_user_storage(clerk_user_id, minio_alias='local', mc_path=None, minio_endpoint='localhost:9000')
¶
Komplettes Setup für einen User
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clerk_user_id
|
str
|
Clerk User ID |
required |
minio_alias
|
str
|
MinIO mc Alias |
'local'
|
mc_path
|
str
|
Pfad zu mc Binary |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[MinIOUserCredentials, ScopedBlobStorage]
|
Tuple von (Credentials, Storage) |
Source code in toolboxv2/utils/clis/minio_user_manager.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
tauri_cli
¶
tauri_cli.py - Tauri Desktop App Build & Management CLI
Commands: - build-worker: Build tb-worker sidecar with Nuitka (includes toolboxv2 package) - build-app: Build Tauri app for current platform - build-all: Build worker + app for all platforms - dev: Start development server - clean: Clean build artifacts
build_frontend(project_root)
¶
Build frontend with webpack.
Source code in toolboxv2/utils/clis/tauri_cli.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
build_tauri_app(project_root, target=None, debug=False)
¶
Build Tauri desktop app.
Source code in toolboxv2/utils/clis/tauri_cli.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
build_worker(output_dir, target=None, standalone=True, onefile=True)
¶
Build tb-worker sidecar with PyInstaller.
Source code in toolboxv2/utils/clis/tauri_cli.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
clean_build(project_root)
¶
Clean build artifacts.
Source code in toolboxv2/utils/clis/tauri_cli.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
create_parser()
¶
Create argument parser.
Source code in toolboxv2/utils/clis/tauri_cli.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
ensure_pyinstaller()
¶
Ensure PyInstaller is installed.
Source code in toolboxv2/utils/clis/tauri_cli.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
get_project_root()
¶
Get ToolBoxV2 project root.
Source code in toolboxv2/utils/clis/tauri_cli.py
42 43 44 45 46 47 48 | |
get_target_triple()
¶
Get current platform's target triple.
Source code in toolboxv2/utils/clis/tauri_cli.py
51 52 53 54 | |
get_worker_binary_name(target)
¶
Get worker binary name for target.
Source code in toolboxv2/utils/clis/tauri_cli.py
57 58 59 60 61 | |
main()
¶
Main entry point.
Source code in toolboxv2/utils/clis/tauri_cli.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
run_dev_server(project_root, no_worker=False, worker_only=False, http_port=5000, ws_port=5001, no_ws=False)
¶
Start Tauri development server with debug options.
Tauri always uses the pre-built dist folder for UI. Worker provides the API (HTTP + WS in unified process).
Source code in toolboxv2/utils/clis/tauri_cli.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
run_worker_debug(project_root, http_port=5000, ws_port=5001, no_ws=False, verbose=True)
¶
Start worker in debug mode (directly, without PyInstaller build).
The worker runs both HTTP and WS servers in a unified process.
Source code in toolboxv2/utils/clis/tauri_cli.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
tb_lang_cli
¶
cli_tbx_main()
¶
Main entry point for TB Language CLI
Source code in toolboxv2/utils/clis/tb_lang_cli.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | |
detect_shell()
¶
Detect shell for running commands
Source code in toolboxv2/utils/clis/tb_lang_cli.py
106 107 108 109 110 111 | |
get_executable_path()
¶
Find the compiled TB executable
Source code in toolboxv2/utils/clis/tb_lang_cli.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_project_dir()
¶
Get the TB language project directory
Source code in toolboxv2/utils/clis/tb_lang_cli.py
83 84 85 | |
get_tb_root()
¶
Get the toolbox root directory
Source code in toolboxv2/utils/clis/tb_lang_cli.py
74 75 76 77 78 79 80 | |
handle_build(release=True, target='native', export_bin=True)
¶
Build the TB language executable for various targets
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
release
|
bool
|
Build in release mode (default: True) |
True
|
target
|
str
|
Build target - native, windows, linux, macos, android, ios, all (default: native) |
'native'
|
export_bin
|
bool
|
Export binaries to bin directory (default: True) |
True
|
Source code in toolboxv2/utils/clis/tb_lang_cli.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
handle_check(file_path)
¶
Check a TB program without executing
Source code in toolboxv2/utils/clis/tb_lang_cli.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | |
handle_clean()
¶
Clean build artifacts
Source code in toolboxv2/utils/clis/tb_lang_cli.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
handle_compile(input_file, output_file, target='native')
¶
Compile a TB program
Source code in toolboxv2/utils/clis/tb_lang_cli.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | |
handle_examples()
¶
Run example programs
Source code in toolboxv2/utils/clis/tb_lang_cli.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | |
handle_ide_extension(args)
¶
Handle language IDE extension operations
Source code in toolboxv2/utils/clis/tb_lang_cli.py
364 365 366 | |
handle_info()
¶
Show system information
Source code in toolboxv2/utils/clis/tb_lang_cli.py
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | |
handle_init(project_name)
¶
Initialize a new TB project
Source code in toolboxv2/utils/clis/tb_lang_cli.py
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | |
handle_repl()
¶
Start TB REPL
Source code in toolboxv2/utils/clis/tb_lang_cli.py
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
handle_run(file_path, mode='jit', watch=False)
¶
Run a TB program
Source code in toolboxv2/utils/clis/tb_lang_cli.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
handle_system_support(args)
¶
Handle system support operations
Source code in toolboxv2/utils/clis/tb_lang_cli.py
360 361 362 | |
handle_test_examples(args)
¶
Handle TB language testing and examples
Source code in toolboxv2/utils/clis/tb_lang_cli.py
368 369 370 | |
tbx_core_v3_cli
¶
TB Lang Core Runtime v3.0.0 - CLI Interface Main entry point for TB Lang Core Runtime with Server Plugin Management
TBXCoreManager
¶
Manager for TB Lang Core Runtime v3.0.0
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | |
build_core(release=True)
¶Build (compile) the TB Lang Core Runtime to a standalone executable
NOTE: Currently the TB Lang compiler has issues with complex type inference in main.tbx. This feature is experimental and may not work until the compiler is improved. For now, use JIT mode with 'start' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
release
|
bool
|
Build in release mode (optimized) |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
True if build successful, False otherwise |
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
build_server_plugin(release=True)
¶Build the Rust server plugin
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | |
check_prerequisites()
¶Check if all prerequisites are met
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
deploy_core()
¶Deploy the compiled core runtime to bin directory
Returns:
| Type | Description |
|---|---|
bool
|
True if deployment successful, False otherwise |
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
get_default_config()
¶Get default configuration
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
info()
¶Show system information
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |
load_config()
¶Load configuration
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
91 92 93 94 95 96 | |
load_state()
¶Load runtime state
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
134 135 136 137 138 139 | |
run_compiled_core(args=None)
¶Run the compiled core runtime executable
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
List[str]
|
Additional arguments to pass to the executable |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Exit code from the executable |
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
run_tbx_script(script_path, args=None, mode='jit')
¶Run a .tbx script using TB Lang compiler
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
run_tests(test_type='all', verbose=False, report_file=None)
¶Run tests and generate detailed error report
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
save_config(config)
¶Save configuration
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
98 99 100 101 | |
save_state(state)
¶Save runtime state
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
141 142 143 144 | |
start_server(background=False, mode='jit')
¶Start TB Lang Core Runtime server
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
status()
¶Show server status
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
stop_server()
¶Stop TB Lang Core Runtime server
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
validate()
¶Validate the installation
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | |
cli_tbx_core()
¶
Main CLI entry point
Source code in toolboxv2/utils/clis/tbx_core_v3_cli.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | |
tcm_p2p_cli
¶
ChatListener
¶
Background thread to listen for new chat messages.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
ChatMessage
dataclass
¶
Represents a chat message with encryption support.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
ChatRoom
dataclass
¶
Represents a P2P chat room with E2E encryption.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
CryptoManager
¶
Handles all E2E encryption operations.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
decrypt_bytes(encrypted_data, key)
staticmethod
¶Decrypt binary data directly (for audio/files).
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
194 195 196 197 198 | |
decrypt_file(encrypted_data, key, output_path)
staticmethod
¶Decrypt file content.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
180 181 182 183 184 185 186 | |
decrypt_message(encrypted_message, key)
staticmethod
¶Decrypt message content.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
167 168 169 170 171 | |
encrypt_bytes(data, key)
staticmethod
¶Encrypt binary data directly (for audio/files).
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
188 189 190 191 192 | |
encrypt_file(file_path, key)
staticmethod
¶Encrypt file content.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
173 174 175 176 177 178 | |
encrypt_message(message, key)
staticmethod
¶Encrypt message content.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
161 162 163 164 165 | |
generate_room_key(room_id, password)
staticmethod
¶Generate encryption key for room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
149 150 151 152 153 154 155 156 157 158 159 | |
EnhancedInstanceManager
¶
Enhanced instance manager with chat integration.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
generate_config(mode, config_data)
¶Generate config.toml for instance.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | |
is_running()
¶Check if instance is running.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1084 1085 1086 1087 | |
read_state()
¶Read instance state.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 | |
start(executable_path, mode, config_data, chat_room=None)
¶Start instance.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | |
stop(timeout=10)
¶Stop instance.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
write_state(state_data)
¶Write instance state.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1078 1079 1080 1081 1082 | |
FileTransferManager
¶
Manages P2P file transfers with E2E encryption.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
prepare_file(file_path)
¶Prepare file for transfer (encrypt and chunk).
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
receive_file(transfer_id, file_name)
¶Receive and decrypt file.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
InteractiveP2PCLI
¶
Interactive P2P CLI with modern ToolBox-style interface.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 | |
chat_menu()
¶Interactive chat menu.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 | |
clear_screen()
¶Clear terminal screen.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1199 1200 1201 | |
p2p_menu()
¶P2P configuration menu.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 | |
print_header()
¶Print main header.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1203 1204 1205 1206 1207 1208 1209 1210 | |
print_menu()
¶Print main menu.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | |
run()
¶Main application loop.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 | |
settings_menu()
¶Settings menu.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 | |
status_menu(do_clear=True)
¶Status and monitoring menu.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 | |
P2PChatManager
¶
Manages E2E encrypted chat rooms with file and voice support.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
create_room(name, password, max_participants=10, voice_enabled=False, private=False)
¶Create a new chat room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
get_messages(room_id, password, limit=50)
¶Get decrypted messages from room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
join_room(room_id, password)
¶Join an existing chat room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
leave_room(room_id)
¶Leave a chat room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
list_rooms(show_all=False)
¶List available rooms for user.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 | |
lock_room(room_id)
¶Lock a room to prevent new participants.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
receive_file(room_id, transfer_id, file_name)
¶Receive and decrypt file from room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | |
send_file(room_id, file_path, password)
¶Send encrypted file to room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | |
send_message(room_id, content, password)
¶Send encrypted text message to room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
P2PConnection
dataclass
¶
Represents a P2P connection configuration.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
133 134 135 136 137 138 139 140 141 | |
VoiceChatManager
¶
Manages P2P voice chat with live streaming and speaker detection.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |
calculate_rms(audio_data)
¶Calculate RMS (Root Mean Square) for voice activity detection.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
283 284 285 286 287 288 289 290 291 | |
cleanup()
¶Cleanup voice resources.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |
connect_to_voice_server(host, port)
¶Connect to voice relay server.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
411 412 413 414 415 416 417 418 419 420 | |
get_current_speaker()
¶Get username of current speaker.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
583 584 585 | |
start_recording_stream()
¶Start streaming microphone input to server.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
start_voice_server(port=0)
¶Start voice relay server for this room.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
stop_recording()
¶Stop recording stream.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
579 580 581 | |
cli_tcm_runner()
¶
Main CLI entry point.
Source code in toolboxv2/utils/clis/tcm_p2p_cli.py
2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 | |
user_dashboard
¶
interactive_user_dashboard()
async
¶
Modern interactive user dashboard and mini CLI
Source code in toolboxv2/utils/clis/user_dashboard.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | |
venv_runner
¶
Modern Package Manager Runner - Supporting conda, uv, and native Python
BasePackageManager
¶
Base class for package managers.
Source code in toolboxv2/utils/clis/venv_runner.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
CommandRunner
¶
Enhanced command runner with better output handling.
Source code in toolboxv2/utils/clis/venv_runner.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
run(command, live=True, capture=False)
¶Execute command with optional live output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Command to execute |
required |
live
|
bool
|
Stream output in real-time |
True
|
capture
|
bool
|
Capture and return output |
False
|
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[str]]
|
Tuple of (success, output) |
Source code in toolboxv2/utils/clis/venv_runner.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
CondaManager
¶
Conda package manager implementation.
Source code in toolboxv2/utils/clis/venv_runner.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
NativeManager
¶
Native Python (venv + pip) manager implementation.
Source code in toolboxv2/utils/clis/venv_runner.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
PackageManager
¶
Supported package managers.
Source code in toolboxv2/utils/clis/venv_runner.py
24 25 26 27 28 | |
UVManager
¶
UV package manager implementation.
Source code in toolboxv2/utils/clis/venv_runner.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | |
create_manager(pm_type)
¶
Create appropriate package manager.
Source code in toolboxv2/utils/clis/venv_runner.py
569 570 571 572 573 574 575 576 577 578 | |
create_parser()
¶
Create modern CLI parser.
Source code in toolboxv2/utils/clis/venv_runner.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | |
detect_package_manager()
¶
Auto-detect available package manager.
Source code in toolboxv2/utils/clis/venv_runner.py
64 65 66 67 68 69 70 71 | |
discover_environments()
¶
Discover existing environments from all package managers.
Source code in toolboxv2/utils/clis/venv_runner.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
get_encoding()
¶
Get system encoding with fallback.
Source code in toolboxv2/utils/clis/venv_runner.py
74 75 76 77 78 79 | |
handle_create(args, manager)
¶
Handle environment creation.
Source code in toolboxv2/utils/clis/venv_runner.py
738 739 740 741 742 743 744 745 746 747 748 | |
handle_delete(args, manager)
¶
Handle environment deletion.
Source code in toolboxv2/utils/clis/venv_runner.py
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | |
handle_discover(args, manager)
¶
Handle environment discovery.
Source code in toolboxv2/utils/clis/venv_runner.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
handle_exec(args, manager)
¶
Handle command execution.
Source code in toolboxv2/utils/clis/venv_runner.py
865 866 867 868 869 870 871 872 873 | |
handle_info(args, manager)
¶
Handle info display.
Source code in toolboxv2/utils/clis/venv_runner.py
900 901 902 903 904 905 906 907 908 909 910 911 | |
handle_install(args, manager)
¶
Handle package installation.
Source code in toolboxv2/utils/clis/venv_runner.py
793 794 795 796 797 798 799 800 801 802 803 | |
handle_list(args, manager)
¶
Handle environment listing.
Source code in toolboxv2/utils/clis/venv_runner.py
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
handle_packages(args, manager)
¶
Handle package listing.
Source code in toolboxv2/utils/clis/venv_runner.py
832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | |
handle_registry(args, manager)
¶
Handle registry creation.
Source code in toolboxv2/utils/clis/venv_runner.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | |
handle_run(args, manager)
¶
Handle script execution.
Source code in toolboxv2/utils/clis/venv_runner.py
854 855 856 857 858 859 860 861 862 | |
handle_update(args, manager)
¶
Handle package update.
Source code in toolboxv2/utils/clis/venv_runner.py
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | |
main()
¶
Main entry point.
Source code in toolboxv2/utils/clis/venv_runner.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | |
print_header(title)
¶
Print section header.
Source code in toolboxv2/utils/clis/venv_runner.py
56 57 58 59 60 61 | |
print_status(status, message)
¶
Print colored status message.
Source code in toolboxv2/utils/clis/venv_runner.py
43 44 45 46 47 48 49 50 51 52 53 | |
save_discovered_environments(discovered)
¶
Save discovered environments to registry file.
Source code in toolboxv2/utils/clis/venv_runner.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
daemon
¶
DaemonUtil
¶
Source code in toolboxv2/utils/daemon/daemon_util.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/daemon/daemon_util.py
19 20 21 22 23 24 25 26 27 | |
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/daemon/daemon_util.py
29 30 31 32 33 34 35 | |
start_server(connection_type=None)
async
¶
Start the server using app and the socket manager
Source code in toolboxv2/utils/daemon/daemon_util.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
daemon_util
¶
DaemonUtil
¶
Source code in toolboxv2/utils/daemon/daemon_util.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/daemon/daemon_util.py
19 20 21 22 23 24 25 26 27 | |
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/daemon/daemon_util.py
29 30 31 32 33 34 35 | |
start_server(connection_type=None)
async
¶Start the server using app and the socket manager
Source code in toolboxv2/utils/daemon/daemon_util.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
extras
¶
BaseWidget
¶
Source code in toolboxv2/utils/extras/base_widget.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
create_iframe_asset(app, iframe_id, asset_id=None)
¶
Erstellt ein Asset für einen registrierten iframe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
load_iframe(app, iframe_id, asset_id=None)
¶
Lädt einen registrierten iframe und gibt das HTML-Element zurück
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
280 281 282 283 284 285 286 287 288 289 290 | |
modify_iterator(iterator, replace)
¶
['a', 'b'] -> [{replace[0]: 'a',..., replace[len(replace)-1]: 'a'}, {replace[0]: 'b',..., replace[len(replace)-1]: 'b'}, ]
Source code in toolboxv2/utils/extras/base_widget.py
94 95 96 97 98 99 100 101 102 103 | |
register_iframe(iframe_id, src, width='100%', height='500px', **kwargs)
¶
Registriert einen iframe mit gegebener ID und Quelle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iframe_id
|
str
|
Eindeutige ID für den iframe |
required |
src
|
str
|
URL oder Pfad zur Quelle des iframes |
required |
width
|
str
|
Breite des iframes (default: "100%") |
'100%'
|
height
|
str
|
Höhe des iframes (default: "500px") |
'500px'
|
**kwargs
|
Weitere iframe-Attribute |
{}
|
Source code in toolboxv2/utils/extras/base_widget.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
ask_question(title, message, yes_callback=None, no_callback=None, **kwargs)
¶
Ask a yes/no question
Source code in toolboxv2/utils/extras/notification.py
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
quick_error(title, message, **kwargs)
¶
Quick error notification
Source code in toolboxv2/utils/extras/notification.py
1019 1020 1021 1022 | |
quick_info(title, message, **kwargs)
¶
Quick info notification
Source code in toolboxv2/utils/extras/notification.py
1001 1002 1003 1004 | |
quick_success(title, message, **kwargs)
¶
Quick success notification
Source code in toolboxv2/utils/extras/notification.py
1007 1008 1009 1010 | |
quick_warning(title, message, **kwargs)
¶
Quick warning notification
Source code in toolboxv2/utils/extras/notification.py
1013 1014 1015 1016 | |
Style
¶
Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
__enter__()
¶Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
652 653 654 655 656 657 | |
__exit__(exc_type, exc_value, exc_traceback)
¶Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
659 660 661 662 663 664 665 666 | |
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
SpinnerManager
¶
Manages multiple spinners to ensure tqdm-like line rendering. Automatically captures SIGINT (Ctrl+C) to stop all spinners.
Source code in toolboxv2/utils/extras/Style.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
register_spinner(spinner)
¶Register a new spinner.
Source code in toolboxv2/utils/extras/Style.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
unregister_spinner(spinner)
¶Unregister a completed spinner.
Source code in toolboxv2/utils/extras/Style.py
547 548 549 550 551 | |
base_widget
¶
BaseWidget
¶
Source code in toolboxv2/utils/extras/base_widget.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
create_iframe_asset(app, iframe_id, asset_id=None)
¶Erstellt ein Asset für einen registrierten iframe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
load_iframe(app, iframe_id, asset_id=None)
¶Lädt einen registrierten iframe und gibt das HTML-Element zurück
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
280 281 282 283 284 285 286 287 288 289 290 | |
modify_iterator(iterator, replace)
¶['a', 'b'] -> [{replace[0]: 'a',..., replace[len(replace)-1]: 'a'}, {replace[0]: 'b',..., replace[len(replace)-1]: 'b'}, ]
Source code in toolboxv2/utils/extras/base_widget.py
94 95 96 97 98 99 100 101 102 103 | |
register_iframe(iframe_id, src, width='100%', height='500px', **kwargs)
¶Registriert einen iframe mit gegebener ID und Quelle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iframe_id
|
str
|
Eindeutige ID für den iframe |
required |
src
|
str
|
URL oder Pfad zur Quelle des iframes |
required |
width
|
str
|
Breite des iframes (default: "100%") |
'100%'
|
height
|
str
|
Höhe des iframes (default: "500px") |
'500px'
|
**kwargs
|
Weitere iframe-Attribute |
{}
|
Source code in toolboxv2/utils/extras/base_widget.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
blobs
¶
BlobFile
¶
File-like interface for blob storage.
Source code in toolboxv2/utils/extras/blobs.py
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | |
__init__(filename, mode='r', storage=None, key=None, servers=None, use_cache=True)
¶Initialize BlobFile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path in format 'blob_id/folder/file.txt' |
required |
mode
|
str
|
'r' for read, 'w' for write, 'rw' for both |
'r'
|
storage
|
Optional[BlobStorage]
|
BlobStorage instance (created if not provided) |
None
|
key
|
Optional[bytes]
|
Custom encryption key |
None
|
servers
|
Optional[List[str]]
|
Server list (for compatibility, ignored) |
None
|
use_cache
|
bool
|
Use local cache |
True
|
Source code in toolboxv2/utils/extras/blobs.py
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | |
clear()
¶Clear the data buffer
Source code in toolboxv2/utils/extras/blobs.py
1350 1351 1352 | |
create()
¶Create the blob if it doesn't exist
Source code in toolboxv2/utils/extras/blobs.py
1249 1250 1251 1252 | |
exists()
¶Check if the file exists in the blob
Source code in toolboxv2/utils/extras/blobs.py
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | |
read()
¶Read data from buffer
Source code in toolboxv2/utils/extras/blobs.py
1365 1366 1367 1368 1369 | |
read_json()
¶Read and parse JSON
Source code in toolboxv2/utils/extras/blobs.py
1371 1372 1373 1374 1375 1376 1377 | |
read_pickle()
¶Read and unpickle data
Source code in toolboxv2/utils/extras/blobs.py
1385 1386 1387 1388 1389 1390 1391 | |
read_yaml()
¶Read and parse YAML
Source code in toolboxv2/utils/extras/blobs.py
1399 1400 1401 1402 1403 1404 1405 | |
stop_watch(callback=None)
¶Stop watching this blob file.
Source code in toolboxv2/utils/extras/blobs.py
1429 1430 1431 | |
watch(callback, max_idle_timeout=600, threaded=True)
¶Watch for changes to this blob file.
Source code in toolboxv2/utils/extras/blobs.py
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 | |
write(data)
¶Write data to buffer
Source code in toolboxv2/utils/extras/blobs.py
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | |
write_json(data)
¶Write JSON data
Source code in toolboxv2/utils/extras/blobs.py
1379 1380 1381 1382 1383 | |
write_pickle(data)
¶Pickle and write data
Source code in toolboxv2/utils/extras/blobs.py
1393 1394 1395 1396 1397 | |
write_yaml(data)
¶Write YAML data
Source code in toolboxv2/utils/extras/blobs.py
1407 1408 1409 1410 1411 | |
BlobStorage
¶
Production-ready client for MinIO-based blob storage.
Features: - Hybrid cloud/local storage - Offline-first with SQLite fallback - Client-side encryption - Watch for live updates - Auto-sync between desktop and cloud
Source code in toolboxv2/utils/extras/blobs.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | |
__init__(mode=None, minio_endpoint=None, minio_access_key=None, minio_secret_key=None, minio_secure=False, use_cloud=None, cloud_endpoint=None, cloud_access_key=None, cloud_secret_key=None, storage_directory='./.data/blob_cache', user_id=None, encryption_key=None, auto_sync=True, bucket=DEFAULT_BUCKET)
¶Initialize BlobStorage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
Optional[StorageMode]
|
Operating mode (SERVER, DESKTOP, MOBILE, OFFLINE). If None, auto-detects based on environment: - Tauri/Desktop → MOBILE (SQLite only) - Production/Dev → SERVER (MinIO) |
None
|
minio_endpoint
|
Optional[str]
|
Local MinIO endpoint (for DESKTOP/SERVER) |
None
|
minio_access_key
|
Optional[str]
|
MinIO access key |
None
|
minio_secret_key
|
Optional[str]
|
MinIO secret key |
None
|
minio_secure
|
bool
|
Use HTTPS |
False
|
cloud_endpoint
|
Optional[str]
|
Cloud MinIO endpoint for sync |
None
|
cloud_access_key
|
Optional[str]
|
Cloud access key |
None
|
cloud_secret_key
|
Optional[str]
|
Cloud secret key |
None
|
storage_directory
|
str
|
Local storage directory |
'./.data/blob_cache'
|
user_id
|
Optional[str]
|
User ID for namespacing |
None
|
encryption_key
|
Optional[bytes]
|
User-specific encryption key |
None
|
auto_sync
|
bool
|
Enable automatic sync |
True
|
bucket
|
str
|
MinIO bucket name |
DEFAULT_BUCKET
|
Source code in toolboxv2/utils/extras/blobs.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
close()
¶Close storage and cleanup
Source code in toolboxv2/utils/extras/blobs.py
1177 1178 1179 1180 1181 | |
create_blob(data, blob_id=None, encrypt=True)
¶Create a new blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Binary data to store |
required |
blob_id
|
Optional[str]
|
Optional blob ID (generated if not provided) |
None
|
encrypt
|
bool
|
Whether to encrypt data |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Blob ID |
Source code in toolboxv2/utils/extras/blobs.py
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |
delete_blob(blob_id)
¶Delete a blob
Source code in toolboxv2/utils/extras/blobs.py
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | |
get_blob_meta(blob_id)
¶Get blob metadata
Source code in toolboxv2/utils/extras/blobs.py
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
get_server_status()
¶Get storage status
Source code in toolboxv2/utils/extras/blobs.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | |
get_user_id()
¶Get current user ID
Source code in toolboxv2/utils/extras/blobs.py
1115 1116 1117 | |
list_blobs(prefix='')
¶List all blobs with optional prefix filter
Source code in toolboxv2/utils/extras/blobs.py
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | |
manual_sync()
¶Trigger manual sync (for mobile)
Source code in toolboxv2/utils/extras/blobs.py
1109 1110 1111 | |
read_blob(blob_id, use_cache=True, decrypt=True)
¶Read blob data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blob_id
|
str
|
Blob ID |
required |
use_cache
|
bool
|
Use local cache if available |
True
|
decrypt
|
bool
|
Decrypt data if encrypted |
True
|
Returns:
| Type | Description |
|---|---|
Optional[bytes]
|
Blob data or None |
Source code in toolboxv2/utils/extras/blobs.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
set_user_context(user_id)
¶Set user context for server mode (admin operations)
Source code in toolboxv2/utils/extras/blobs.py
1119 1120 1121 | |
stop_watch(blob_id, callback=None)
¶Stop watching a blob
Source code in toolboxv2/utils/extras/blobs.py
941 942 943 | |
sync(force=False)
¶Synchronize local and cloud storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Force full sync |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Sync statistics |
Source code in toolboxv2/utils/extras/blobs.py
982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | |
update_blob(blob_id, data, encrypt=True)
¶Update an existing blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blob_id
|
str
|
Blob ID |
required |
data
|
bytes
|
New data |
required |
encrypt
|
bool
|
Encrypt data |
True
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Update result with version info |
Source code in toolboxv2/utils/extras/blobs.py
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | |
watch(blob_id, callback, max_idle_timeout=600, threaded=True, **kwargs)
¶Register a watch callback for a blob
Source code in toolboxv2/utils/extras/blobs.py
930 931 932 933 934 935 936 937 938 939 | |
watch_resource(timeout=60)
¶Watch for any resource changes (for compatibility)
Source code in toolboxv2/utils/extras/blobs.py
945 946 947 948 949 | |
ConnectionState
¶
Connection state for storage backend
Source code in toolboxv2/utils/extras/blobs.py
116 117 118 119 120 121 122 123 124 | |
CryptoLayer
¶
Encryption layer for blob data - client-side encryption
Source code in toolboxv2/utils/extras/blobs.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
__init__(user_key=None)
¶Initialize crypto layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_key
|
Optional[bytes]
|
User-specific encryption key. If None, uses device key. |
None
|
Source code in toolboxv2/utils/extras/blobs.py
179 180 181 182 183 184 185 186 187 | |
decrypt(data, key=None)
¶Decrypt data
Source code in toolboxv2/utils/extras/blobs.py
227 228 229 230 231 232 233 234 235 236 237 238 | |
encrypt(data, key=None)
¶Encrypt data
Source code in toolboxv2/utils/extras/blobs.py
213 214 215 216 217 218 219 220 221 222 223 224 225 | |
sign(data)
¶Create signature/hash for data integrity
Source code in toolboxv2/utils/extras/blobs.py
240 241 242 | |
verify(data, signature)
¶Verify data integrity
Source code in toolboxv2/utils/extras/blobs.py
244 245 246 | |
ServerStatus
dataclass
¶
Status information for a storage backend
Source code in toolboxv2/utils/extras/blobs.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
StorageMode
¶
Operating mode for blob storage
Source code in toolboxv2/utils/extras/blobs.py
107 108 109 110 111 112 113 | |
WatchCallback
dataclass
¶
Wrapper for a watch callback with metadata.
Source code in toolboxv2/utils/extras/blobs.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
WatchManager
¶
Manages watch operations for blob changes.
Source code in toolboxv2/utils/extras/blobs.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
create_auto_storage(**kwargs)
¶
Create storage with automatic mode detection based on environment.
- Tauri/Desktop environment → MOBILE mode (SQLite only)
- Production/Cloud environment → SERVER mode (MinIO)
- Development environment → SERVER mode (MinIO with dev credentials)
If MinIO authentication fails, automatically falls back to OFFLINE mode.
Returns:
| Name | Type | Description |
|---|---|---|
BlobStorage |
BlobStorage
|
Configured storage instance |
Source code in toolboxv2/utils/extras/blobs.py
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | |
create_desktop_storage(cloud_endpoint=None, cloud_access_key=None, cloud_secret_key=None, **kwargs)
¶
Create storage for desktop mode with optional cloud sync
Source code in toolboxv2/utils/extras/blobs.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | |
create_mobile_storage(**kwargs)
¶
Create storage for mobile mode (SQLite only)
Source code in toolboxv2/utils/extras/blobs.py
1471 1472 1473 1474 1475 1476 1477 | |
create_offline_storage(**kwargs)
¶
Create storage for offline mode
Source code in toolboxv2/utils/extras/blobs.py
1480 1481 1482 1483 1484 1485 1486 | |
create_server_storage(endpoint=None, access_key=None, secret_key=None, **kwargs)
¶
Create storage for server mode
Source code in toolboxv2/utils/extras/blobs.py
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | |
detect_storage_mode()
¶
Detect the appropriate storage mode based on environment.
- Tauri/Desktop mode → MOBILE (SQLite only, offline-first)
- Production/Cloud mode → SERVER (MinIO with server credentials)
- Development mode → SERVER (MinIO with dev credentials)
Returns:
| Name | Type | Description |
|---|---|---|
StorageMode |
StorageMode
|
The detected storage mode |
Source code in toolboxv2/utils/extras/blobs.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
db
¶
minio_manager
¶
MinIOClientWrapper
¶Wrapper for MinIO Client (mc) operations
Source code in toolboxv2/utils/extras/db/minio_manager.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
create_bucket(alias, bucket)
¶Create a bucket
Source code in toolboxv2/utils/extras/db/minio_manager.py
615 616 617 618 619 620 621 622 | |
list_objects(path, recursive=False)
¶List objects in a bucket/path
Source code in toolboxv2/utils/extras/db/minio_manager.py
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
remove_alias(alias)
¶Remove an alias
Source code in toolboxv2/utils/extras/db/minio_manager.py
604 605 606 607 608 609 610 611 612 613 | |
set_alias(alias, config)
¶Configure an alias for a MinIO server
Source code in toolboxv2/utils/extras/db/minio_manager.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
setup_replication(source_alias, target_alias, bucket)
¶Setup bucket replication between two MinIO instances
Source code in toolboxv2/utils/extras/db/minio_manager.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
start_mirror(source, target, watch=True)
¶Start mirroring between source and target
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Source path (alias/bucket) |
required |
target
|
str
|
Target path (alias/bucket) |
required |
watch
|
bool
|
If True, watch for changes and sync continuously |
True
|
Returns:
| Type | Description |
|---|---|
Optional[Popen]
|
Popen object if watch=True, None otherwise |
Source code in toolboxv2/utils/extras/db/minio_manager.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | |
MinIOConfig
dataclass
¶Configuration for a MinIO instance
Source code in toolboxv2/utils/extras/db/minio_manager.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
MinIOInstaller
¶Cross-platform MinIO installer
Source code in toolboxv2/utils/extras/db/minio_manager.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
get_mc_path()
¶Get path to MinIO Client (mc) binary
Source code in toolboxv2/utils/extras/db/minio_manager.py
232 233 234 235 236 237 238 239 240 241 242 243 244 | |
get_minio_path()
¶Get path to MinIO binary
Source code in toolboxv2/utils/extras/db/minio_manager.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
get_version()
¶Get installed MinIO version
Source code in toolboxv2/utils/extras/db/minio_manager.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
install_all(progress_callback=None)
¶Install both MinIO server and client
Source code in toolboxv2/utils/extras/db/minio_manager.py
284 285 286 287 288 | |
install_mc(progress_callback=None)
¶Install MinIO Client (mc) binary
Source code in toolboxv2/utils/extras/db/minio_manager.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
install_minio(progress_callback=None)
¶Install MinIO server binary
Source code in toolboxv2/utils/extras/db/minio_manager.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
is_mc_installed()
¶Check if MinIO Client is installed
Source code in toolboxv2/utils/extras/db/minio_manager.py
250 251 252 | |
is_minio_installed()
¶Check if MinIO is installed
Source code in toolboxv2/utils/extras/db/minio_manager.py
246 247 248 | |
MinIOInstance
¶Manages a running MinIO instance
Source code in toolboxv2/utils/extras/db/minio_manager.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_health()
¶Get health information
Source code in toolboxv2/utils/extras/db/minio_manager.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_status()
¶Get current status of MinIO instance
Source code in toolboxv2/utils/extras/db/minio_manager.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
restart(wait_ready=True)
¶Restart MinIO server
Source code in toolboxv2/utils/extras/db/minio_manager.py
525 526 527 528 529 | |
start(wait_ready=True, timeout=30)
¶Start MinIO server
Source code in toolboxv2/utils/extras/db/minio_manager.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
stop(timeout=10)
¶Stop MinIO server
Source code in toolboxv2/utils/extras/db/minio_manager.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
MinIOManager
¶High-level manager for MinIO setup and operations
Source code in toolboxv2/utils/extras/db/minio_manager.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | |
create_instance(name, config)
¶Create a new MinIO instance configuration
Source code in toolboxv2/utils/extras/db/minio_manager.py
771 772 773 774 775 776 | |
get_all_status()
¶Get status of all instances
Source code in toolboxv2/utils/extras/db/minio_manager.py
975 976 977 978 979 980 | |
get_instance(name)
¶Get instance by name
Source code in toolboxv2/utils/extras/db/minio_manager.py
778 779 780 | |
install(progress_callback=None)
¶Install MinIO and mc
Source code in toolboxv2/utils/extras/db/minio_manager.py
767 768 769 | |
remove_instance(name, delete_data=False)
¶Remove an instance
Source code in toolboxv2/utils/extras/db/minio_manager.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | |
setup_desktop(name='local', cloud_endpoint=None, cloud_access_key=None, cloud_secret_key=None, auto_sync=True)
¶Setup a desktop client with optional cloud sync
Source code in toolboxv2/utils/extras/db/minio_manager.py
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | |
setup_replication(source_name, target_name)
¶Setup server-to-server replication
Source code in toolboxv2/utils/extras/db/minio_manager.py
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
setup_server(name='cloud', port=9000, data_dir=None, access_key='admin', secret_key='SecureCloudPass', use_docker=False)
¶Setup a central cloud server
Source code in toolboxv2/utils/extras/db/minio_manager.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
start_all()
¶Start all configured instances
Source code in toolboxv2/utils/extras/db/minio_manager.py
982 983 984 985 986 987 988 989 | |
start_bidirectional_sync(local_alias, cloud_alias, bucket)
¶Start bidirectional sync between local and cloud
Source code in toolboxv2/utils/extras/db/minio_manager.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | |
stop_all()
¶Stop all instances and sync processes
Source code in toolboxv2/utils/extras/db/minio_manager.py
991 992 993 994 995 996 997 998 999 1000 | |
stop_all_sync()
¶Stop all sync processes
Source code in toolboxv2/utils/extras/db/minio_manager.py
945 946 947 948 949 950 951 952 953 954 | |
MinIOMode
¶Operating mode for MinIO
Source code in toolboxv2/utils/extras/db/minio_manager.py
47 48 49 50 51 | |
MinIOStatus
¶Status of MinIO instance
Source code in toolboxv2/utils/extras/db/minio_manager.py
54 55 56 57 58 59 | |
quick_desktop_setup(cloud_endpoint, cloud_access_key, cloud_secret_key)
¶Quick desktop setup with cloud sync
Source code in toolboxv2/utils/extras/db/minio_manager.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | |
quick_install()
¶Quick install MinIO
Source code in toolboxv2/utils/extras/db/minio_manager.py
1004 1005 1006 1007 | |
quick_server_setup(port=9000, access_key='admin', secret_key='SecurePass123')
¶Quick server setup
Source code in toolboxv2/utils/extras/db/minio_manager.py
1010 1011 1012 1013 1014 | |
mobile_db
¶
BlobMetadata
dataclass
¶Metadata for a stored blob
Source code in toolboxv2/utils/extras/db/mobile_db.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
MobileDB
¶SQLite-based local storage for mobile and offline scenarios.
Features: - Offline-first design - Dirty tracking for sync - Auto-size management - Encryption-ready - Watch callbacks for changes
Source code in toolboxv2/utils/extras/db/mobile_db.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | |
__init__(db_path='mobile_data.db', max_size_mb=500, auto_vacuum=True)
¶Initialize MobileDB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_path
|
str
|
Path to SQLite database file |
'mobile_data.db'
|
max_size_mb
|
int
|
Maximum database size in MB (for auto-cleanup) |
500
|
auto_vacuum
|
bool
|
Enable auto-vacuum |
True
|
Source code in toolboxv2/utils/extras/db/mobile_db.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
cleanup_old_synced(target_size=None, max_age_days=30)
¶Clean up old synced blobs to free space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_size
|
Optional[int]
|
Target database size in bytes |
None
|
max_age_days
|
int
|
Remove synced blobs older than this |
30
|
Returns:
| Type | Description |
|---|---|
int
|
Number of blobs removed |
Source code in toolboxv2/utils/extras/db/mobile_db.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | |
close()
¶Close database connection
Source code in toolboxv2/utils/extras/db/mobile_db.py
206 207 208 209 210 211 | |
delete(path, hard_delete=False)
¶Delete a blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path/key of the blob |
required |
hard_delete
|
bool
|
If True, remove immediately. If False, mark for sync deletion. |
False
|
Returns:
| Type | Description |
|---|---|
bool
|
True if blob was found and deleted |
Source code in toolboxv2/utils/extras/db/mobile_db.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |
exists(path)
¶Check if a blob exists
Source code in toolboxv2/utils/extras/db/mobile_db.py
344 345 346 347 348 349 350 351 | |
export_for_sync()
¶Export dirty blobs for sync to cloud.
Yields:
| Type | Description |
|---|---|
Tuple[str, bytes, BlobMetadata]
|
Tuple of (path, data, metadata) for each dirty blob |
Source code in toolboxv2/utils/extras/db/mobile_db.py
626 627 628 629 630 631 632 633 634 635 636 | |
get(path)
¶Retrieve blob data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path/key of the blob |
required |
Returns:
| Type | Description |
|---|---|
Optional[bytes]
|
Blob data or None if not found |
Source code in toolboxv2/utils/extras/db/mobile_db.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_db_size()
¶Get current database file size in bytes
Source code in toolboxv2/utils/extras/db/mobile_db.py
555 556 557 558 559 | |
get_dirty_blobs()
¶Get all blobs that need to be synced to cloud
Source code in toolboxv2/utils/extras/db/mobile_db.py
386 387 388 | |
get_manifest()
¶Get local manifest for sync comparison.
Returns:
| Type | Description |
|---|---|
Dict[str, Tuple[str, float]]
|
Dict of {path: (checksum, timestamp)} |
Source code in toolboxv2/utils/extras/db/mobile_db.py
677 678 679 680 681 682 683 684 685 686 687 | |
get_metadata(path)
¶Get metadata for a blob
Source code in toolboxv2/utils/extras/db/mobile_db.py
300 301 302 303 304 305 306 307 308 | |
get_pending_deletes()
¶Get blobs marked for deletion
Source code in toolboxv2/utils/extras/db/mobile_db.py
390 391 392 | |
get_sync_stats()
¶Get statistics about sync status
Source code in toolboxv2/utils/extras/db/mobile_db.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
import_from_cloud(path, data, cloud_timestamp, checksum)
¶Import a blob from cloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Blob path |
required |
data
|
bytes
|
Blob data |
required |
cloud_timestamp
|
float
|
Cloud modification timestamp |
required |
checksum
|
str
|
Cloud checksum for verification |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if imported successfully |
Source code in toolboxv2/utils/extras/db/mobile_db.py
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | |
list(prefix='', include_deleted=False, sync_status=None)
¶List blobs with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Path prefix to filter by |
''
|
include_deleted
|
bool
|
Include deleted blobs |
False
|
sync_status
|
Optional[SyncStatus]
|
Filter by sync status |
None
|
Returns:
| Type | Description |
|---|---|
List[BlobMetadata]
|
List of BlobMetadata objects |
Source code in toolboxv2/utils/extras/db/mobile_db.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
mark_conflict(path)
¶Mark a blob as having a sync conflict
Source code in toolboxv2/utils/extras/db/mobile_db.py
403 404 405 406 407 408 409 | |
mark_synced(path, cloud_timestamp=None)
¶Mark a blob as synced with cloud
Source code in toolboxv2/utils/extras/db/mobile_db.py
394 395 396 397 398 399 400 401 | |
needs_sync(cloud_manifest)
¶Compare local state with cloud manifest to determine sync actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud_manifest
|
Dict[str, Tuple[str, float]]
|
Dict of {path: (checksum, timestamp)} from cloud |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
Dict of {path: action} where action is 'upload', 'download', or 'conflict' |
Source code in toolboxv2/utils/extras/db/mobile_db.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
put(path, data, content_type='application/octet-stream', encrypted=True, skip_sync=False)
¶Store a blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Unique path/key for the blob |
required |
data
|
bytes
|
Binary data to store |
required |
content_type
|
str
|
MIME type |
'application/octet-stream'
|
encrypted
|
bool
|
Whether data is encrypted |
True
|
skip_sync
|
bool
|
If True, mark as synced (for cloud-pulled data) |
False
|
Returns:
| Type | Description |
|---|---|
BlobMetadata
|
BlobMetadata for the stored blob |
Source code in toolboxv2/utils/extras/db/mobile_db.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
resolve_conflict(path, use_local=True)
¶Resolve a sync conflict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Blob path |
required |
use_local
|
bool
|
If True, keep local version. If False, cloud wins. |
True
|
Source code in toolboxv2/utils/extras/db/mobile_db.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
unwatch(callback_id)
¶Remove a watch subscription
Source code in toolboxv2/utils/extras/db/mobile_db.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
vacuum()
¶Run full vacuum to optimize database
Source code in toolboxv2/utils/extras/db/mobile_db.py
619 620 621 622 | |
watch(path_pattern, callback)
¶Watch for changes to blobs matching a pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_pattern
|
str
|
Glob-like pattern (e.g., "user/*" or exact path) |
required |
callback
|
Callable[[str, str, Any], None]
|
Function(path, action, data) called on changes |
required |
Returns:
| Type | Description |
|---|---|
str
|
Subscription ID for unwatch |
Source code in toolboxv2/utils/extras/db/mobile_db.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
MobileDBSyncManager
¶Manages synchronization between MobileDB and MinIO cloud.
Source code in toolboxv2/utils/extras/db/mobile_db.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | |
__init__(mobile_db, minio_client, bucket='user-data-enc', user_id='default')
¶Initialize sync manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mobile_db
|
MobileDB
|
MobileDB instance |
required |
minio_client
|
Any
|
MinIO client for cloud operations |
required |
bucket
|
str
|
MinIO bucket name |
'user-data-enc'
|
user_id
|
str
|
User ID for namespacing |
'default'
|
Source code in toolboxv2/utils/extras/db/mobile_db.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
manual_sync_needed()
¶Check if manual sync is needed (for mobile battery saving)
Source code in toolboxv2/utils/extras/db/mobile_db.py
833 834 835 836 | |
sync(force_full=False)
¶Perform sync with cloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_full
|
bool
|
If True, do full sync instead of incremental |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Sync statistics |
Source code in toolboxv2/utils/extras/db/mobile_db.py
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
SyncStatus
¶Sync status for local objects
Source code in toolboxv2/utils/extras/db/mobile_db.py
37 38 39 40 41 42 43 | |
create_mobile_db(path='~/.toolboxv2/mobile_data.db', max_size_mb=500)
¶Create a MobileDB instance with sensible defaults
Source code in toolboxv2/utils/extras/db/mobile_db.py
841 842 843 844 845 846 847 | |
scoped_storage
¶
ToolBox V2 - Scoped Blob Storage System Multi-User, Multi-Scope Storage mit Clerk Auth Integration
SCOPES: - PUBLIC_READ: Alle lesen, nur Admin schreibt - PUBLIC_RW: Alle lesen/schreiben - USER_PUBLIC: Alle lesen, nur Owner schreibt unter eigenem Prefix - USER_PRIVATE: Nur Owner liest/schreibt (lokal + verschlüsselter Cloud-Sync) - SERVER_SCOPE: Server-spezifische Daten - MOD_DATA: Modul-spezifische Daten
STORAGE: - USER_PRIVATE: Lokal in SQLite, sync zu verschlüsseltem Cloud-Bereich - Alle anderen: Cloud mit lokalem Cache
BlobMetadata
dataclass
¶Metadaten für einen Blob
Source code in toolboxv2/utils/extras/db/scoped_storage.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
Permission
¶Berechtigungstypen
Source code in toolboxv2/utils/extras/db/scoped_storage.py
84 85 86 87 88 89 90 | |
Scope
¶Storage Scopes mit unterschiedlichen Berechtigungen
Source code in toolboxv2/utils/extras/db/scoped_storage.py
74 75 76 77 78 79 80 81 | |
ScopePolicyEngine
¶Bestimmt Berechtigungen basierend auf Scope und User
Source code in toolboxv2/utils/extras/db/scoped_storage.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
build_path(scope, user, path, mod_name=None)
staticmethod
¶Baut den vollständigen Pfad basierend auf Scope
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
Scope
|
Storage Scope |
required |
user
|
UserContext
|
Benutzerkontext |
required |
path
|
str
|
Relativer Pfad |
required |
mod_name
|
str
|
Modulname (nur für MOD_DATA) |
None
|
Source code in toolboxv2/utils/extras/db/scoped_storage.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
get_bucket_name(scope)
staticmethod
¶Gibt den MinIO Bucket-Namen für einen Scope zurück
Source code in toolboxv2/utils/extras/db/scoped_storage.py
207 208 209 210 211 212 213 214 215 216 217 | |
get_permission(scope, user, resource_owner=None)
staticmethod
¶Ermittelt die Berechtigung eines Users für einen Scope
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
Scope
|
Der Scope des Blobs |
required |
user
|
UserContext
|
Der anfragende Benutzer |
required |
resource_owner
|
str
|
Owner-ID des Blobs (für USER_* Scopes) |
None
|
Source code in toolboxv2/utils/extras/db/scoped_storage.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
ScopedBlobStorage
¶Hauptklasse für Scope-basierten Blob Storage
Features: - Multi-Scope Support (PUBLIC_READ, PUBLIC_RW, USER_PUBLIC, USER_PRIVATE, SERVER, MOD) - Clerk Auth Integration - Lokale SQLite für USER_PRIVATE - Cache für andere Scopes - Automatische Verschlüsselung für USER_PRIVATE
Source code in toolboxv2/utils/extras/db/scoped_storage.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |
close()
¶Schließt alle Verbindungen
Source code in toolboxv2/utils/extras/db/scoped_storage.py
934 935 936 937 | |
delete(path, scope=Scope.USER_PRIVATE, mod_name=None)
¶Löscht einen Blob
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relativer Pfad |
required |
scope
|
Scope
|
Storage Scope |
USER_PRIVATE
|
mod_name
|
str
|
Modulname (nur für MOD_DATA) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True wenn erfolgreich gelöscht |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
exists(path, scope=Scope.USER_PRIVATE, owner_id=None, mod_name=None)
¶Prüft ob ein Blob existiert
Source code in toolboxv2/utils/extras/db/scoped_storage.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
list(prefix='', scope=Scope.USER_PRIVATE, owner_id=None, mod_name=None, recursive=True)
¶Listet Blobs in einem Pfad
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Pfad-Prefix |
''
|
scope
|
Scope
|
Storage Scope |
USER_PRIVATE
|
owner_id
|
str
|
Owner-ID (für USER_* Scopes) |
None
|
mod_name
|
str
|
Modulname (nur für MOD_DATA) |
None
|
recursive
|
bool
|
Auch Unterverzeichnisse |
True
|
Returns:
| Type | Description |
|---|---|
List[BlobMetadata]
|
Liste von BlobMetadata |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | |
read(path, scope=Scope.USER_PRIVATE, owner_id=None, mod_name=None, use_cache=True)
¶Liest Daten aus dem Storage
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relativer Pfad |
required |
scope
|
Scope
|
Storage Scope |
USER_PRIVATE
|
owner_id
|
str
|
Owner-ID (für USER_* Scopes, default: eigener User) |
None
|
mod_name
|
str
|
Modulname (nur für MOD_DATA) |
None
|
use_cache
|
bool
|
Cache verwenden (nicht für USER_PRIVATE) |
True
|
Returns:
| Type | Description |
|---|---|
Optional[bytes]
|
Daten als bytes oder None wenn nicht gefunden |
Raises:
| Type | Description |
|---|---|
PermissionError
|
Wenn User keine Leseberechtigung hat |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
sync_private()
¶Synchronisiert USER_PRIVATE zwischen lokal und Cloud
Returns:
| Type | Description |
|---|---|
Dict[str, int]
|
Dict mit uploaded/downloaded Counts |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | |
write(path, data, scope=Scope.USER_PRIVATE, mod_name=None, content_type='application/octet-stream', metadata=None)
¶Schreibt Daten in den Storage
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relativer Pfad |
required |
data
|
bytes
|
Zu speichernde Daten |
required |
scope
|
Scope
|
Storage Scope |
USER_PRIVATE
|
mod_name
|
str
|
Modulname (nur für MOD_DATA) |
None
|
content_type
|
str
|
MIME-Type |
'application/octet-stream'
|
metadata
|
Dict[str, str]
|
Custom Metadata |
None
|
Returns:
| Type | Description |
|---|---|
BlobMetadata
|
BlobMetadata mit Infos über den geschriebenen Blob |
Raises:
| Type | Description |
|---|---|
PermissionError
|
Wenn User keine Schreibberechtigung hat |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
ScopedCache
¶Lokaler Cache für nicht-private Scopes
Source code in toolboxv2/utils/extras/db/scoped_storage.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
clear(scope=None)
¶Löscht Cache (optional nur für bestimmten Scope)
Source code in toolboxv2/utils/extras/db/scoped_storage.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
get(scope, path)
¶Holt Daten aus Cache
Source code in toolboxv2/utils/extras/db/scoped_storage.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
invalidate(scope, path)
¶Invalidiert Cache-Eintrag
Source code in toolboxv2/utils/extras/db/scoped_storage.py
364 365 366 367 368 369 370 371 372 373 374 | |
is_valid(scope, path, checksum)
¶Prüft ob Cache-Eintrag noch gültig ist
Source code in toolboxv2/utils/extras/db/scoped_storage.py
376 377 378 379 380 381 382 383 | |
set(scope, path, data, checksum=None)
¶Speichert Daten im Cache
Source code in toolboxv2/utils/extras/db/scoped_storage.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
ScopedCryptoLayer
¶Verschlüsselung für USER_PRIVATE Scope
Source code in toolboxv2/utils/extras/db/scoped_storage.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
decrypt(data, row=True)
¶Entschlüsselt Daten mit User-Key
Source code in toolboxv2/utils/extras/db/scoped_storage.py
280 281 282 283 284 285 286 287 | |
encrypt(data)
¶Verschlüsselt Daten mit User-Key
Source code in toolboxv2/utils/extras/db/scoped_storage.py
270 271 272 273 274 275 276 277 278 | |
UserContext
dataclass
¶Benutzerkontext für Scope-Zugriff
Source code in toolboxv2/utils/extras/db/scoped_storage.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
from_clerk_session(session_data, encryption_key=None)
classmethod
¶Erstellt UserContext aus Clerk Session
Source code in toolboxv2/utils/extras/db/scoped_storage.py
112 113 114 115 116 117 118 119 120 121 122 | |
create_storage_from_clerk_session(session_data, minio_endpoint=None, minio_access_key=None, minio_secret_key=None, local_db_path=None)
¶Erstellt ScopedBlobStorage aus Clerk Session
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_data
|
dict
|
Dict mit user_id, username, session_token, etc. |
required |
minio_*
|
MinIO Verbindungsdaten |
required | |
local_db_path
|
str
|
Pfad zur lokalen SQLite DB |
None
|
Returns:
| Type | Description |
|---|---|
ScopedBlobStorage
|
Konfiguriertes ScopedBlobStorage |
Source code in toolboxv2/utils/extras/db/scoped_storage.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
gist_control
¶
GistLoader
¶
Source code in toolboxv2/utils/extras/gist_control.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
get_spec(module_name)
¶Gibt die Modul-Specifikation zurück.
Source code in toolboxv2/utils/extras/gist_control.py
23 24 25 | |
load_module(module_name)
¶Lädt das Modul mit dem gegebenen Namen.
Source code in toolboxv2/utils/extras/gist_control.py
13 14 15 16 17 18 19 20 21 | |
helper_test_functions
¶
generate_edge_value(param_type)
¶
Generiert Edge-Case-Werte basierend auf dem Parametertyp.
Source code in toolboxv2/utils/extras/helper_test_functions.py
35 36 37 38 39 40 41 42 43 44 | |
generate_normal_value(param_type)
¶
Generiert normale Werte basierend auf dem Parametertyp.
Source code in toolboxv2/utils/extras/helper_test_functions.py
47 48 49 50 51 52 53 54 55 56 57 58 59 | |
keword_matcher
¶
calculate_keyword_score(text, keywords)
¶
Berechnet den Keyword-Score basierend auf der Häufigkeit der Keywords im Text. Case-insensitive und optimiert für Geschwindigkeit.
:param text: Eingabetext als String :param keywords: Set von Keywords :return: Gesamt-Score als Integer
Source code in toolboxv2/utils/extras/keword_matcher.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
calculate_weighted_score(text, keyword_weights)
¶
Berechnet gewichteten Score mit unterschiedlichen Gewichten pro Keyword
:param text: Eingabetext :param keyword_weights: Dictionary mit {Keyword: Gewicht} :return: Gewichteter Gesamt-Score
Source code in toolboxv2/utils/extras/keword_matcher.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
extract_keywords(text, max_len=-1, min_word_length=3, with_weights=False, remove_stopwords=True, stopwords=True)
¶
Extrahiert Keywords mit optionaler Frequenzgewichtung
:param text: Eingabetext :param max_len: Maximale Anzahl Keywords (-1 = alle) :param min_word_length: Minimale Wortlänge :param with_weights: Gibt Wort+Frequenz zurück wenn True :param remove_stopwords: Filtert deutsche Stopwörter :param german_stopwords: Verwendet deutsche Standard-Stopwörter :return: Keywords oder (Keyword, Häufigkeit) Paare
Source code in toolboxv2/utils/extras/keword_matcher.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
mkdocs
¶
Markdown Documentation System - Refactored v2.1¶
Modular, async, memory-efficient documentation management.
Fixes in v2.1: - Inverted Index for O(1) keyword lookups - Proper error logging instead of swallowing - JS/TS support via RegexAnalyzer
Architecture: - DataModels: slots dataclasses for minimal RAM - DocParser: State-machine parser (code-block aware) - CodeAnalyzer: AST-based extraction with visitor pattern - JSTSAnalyzer: Regex-based JS/TS extraction - IndexManager: Thread-safe persistence with atomic writes - ContextEngine: Inverted index for fast lookups - DocsSystem: Facade orchestrating all components
CodeAnalyzer
¶
Efficient AST-based code analyzer using visitor pattern for Python.
Source code in toolboxv2/utils/extras/mkdocs.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
analyze(file_path, use_cache=True)
¶Analyze Python file for code elements.
Source code in toolboxv2/utils/extras/mkdocs.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
clear_cache()
¶Clear analyzer cache.
Source code in toolboxv2/utils/extras/mkdocs.py
546 547 548 | |
CodeElement
dataclass
¶
Code element (class/function/method).
Source code in toolboxv2/utils/extras/mkdocs.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
ContextBundle
¶
Token-optimized context dictionary for LLMs. Structure: { "intent": str, "focus_files": { path: content }, "definitions": [ { signature, docstring, ... } ], "graph": { "upstream": [ { name, file, type } ], # Dependencies (Imports) "downstream": [ { name, file, usage } ] # Usage (Callers) }, "documentation": [ { title, content_snippet, relevance } ] }
Source code in toolboxv2/utils/extras/mkdocs.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
ContextEngine
¶
Fast context lookups using inverted index for O(1) keyword search.
Source code in toolboxv2/utils/extras/mkdocs.py
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | |
get_context_for_element(element_id)
¶Get comprehensive context for a code element.
Source code in toolboxv2/utils/extras/mkdocs.py
1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | |
get_context_for_task(files, intent, max_tokens=8000)
¶Generates a graph-based context bundle optimized for an LLM task.
- Loads code elements for focus files.
- Resolves Upstream (what these files need).
- Resolves Downstream (what uses these files).
- Finds relevant docs based on code entities AND intent.
Source code in toolboxv2/utils/extras/mkdocs.py
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
search_elements(name=None, element_type=None, file_path=None, max_results=25)
¶Fast code element search using inverted index.
Source code in toolboxv2/utils/extras/mkdocs.py
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 | |
search_sections(query=None, file_path=None, tags=None, max_results=25)
¶Fast section search using inverted index.
Source code in toolboxv2/utils/extras/mkdocs.py
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | |
DocParser
¶
State-machine based document parser. Supports: Markdown, RST-style, YAML frontmatter, code-block aware.
Source code in toolboxv2/utils/extras/mkdocs.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
clear_cache()
¶Clear parser cache.
Source code in toolboxv2/utils/extras/mkdocs.py
400 401 402 | |
parse(file_path, use_cache=True)
¶Parse document file into sections.
Source code in toolboxv2/utils/extras/mkdocs.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
DocSection
dataclass
¶
Documentation section with minimal memory footprint.
Source code in toolboxv2/utils/extras/mkdocs.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
DocsIndex
dataclass
¶
Complete documentation index.
Source code in toolboxv2/utils/extras/mkdocs.py
136 137 138 139 140 141 142 143 144 145 146 | |
DocsSystem
¶
Main documentation system facade with multi-language support.
Source code in toolboxv2/utils/extras/mkdocs.py
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 | |
get_suggestions(max_suggestions=20)
async
¶Get documentation improvement suggestions.
Source code in toolboxv2/utils/extras/mkdocs.py
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 | |
get_task_context(files, intent)
async
¶New Endpoint: Get optimized context for a specific editing task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[str]
|
List of file paths relevant to the task. |
required |
intent
|
str
|
Description of what the user wants to do (e.g., "Add logging to auth"). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
ContextBundle dictionary ready for LLM injection. |
Source code in toolboxv2/utils/extras/mkdocs.py
2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 | |
initialize(force_rebuild=False, show_tqdm=False)
async
¶Initialize or load documentation index.
Source code in toolboxv2/utils/extras/mkdocs.py
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 | |
lookup_code(name=None, element_type=None, file_path=None, language=None, include_code=False, max_results=25)
async
¶Look up code elements across all languages.
Source code in toolboxv2/utils/extras/mkdocs.py
1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | |
read(query=None, section_id=None, file_path=None, tags=None, max_results=25, format_type='structured')
async
¶Read documentation sections.
Source code in toolboxv2/utils/extras/mkdocs.py
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 | |
sync()
async
¶Sync index with file system changes.
Source code in toolboxv2/utils/extras/mkdocs.py
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 | |
write(action, **kwargs)
async
¶Write/modify documentation.
Source code in toolboxv2/utils/extras/mkdocs.py
1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | |
FileChange
dataclass
¶
Git file change.
Source code in toolboxv2/utils/extras/mkdocs.py
90 91 92 93 94 95 96 | |
FileScanner
¶
Fast file discovery with filtering.
Source code in toolboxv2/utils/extras/mkdocs.py
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 | |
scan(extensions, use_cache=True, show_tqdm=True)
¶Scan for files with given extensions.
Source code in toolboxv2/utils/extras/mkdocs.py
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | |
GitTracker
¶
Async git change detection.
Source code in toolboxv2/utils/extras/mkdocs.py
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | |
IndexManager
¶
Thread-safe index management with atomic writes and inverted indexing.
Source code in toolboxv2/utils/extras/mkdocs.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | |
load()
async
¶Load index from disk.
Source code in toolboxv2/utils/extras/mkdocs.py
875 876 877 878 879 880 881 882 883 884 885 886 887 | |
remove_file(file_path)
¶Remove all entries for a file.
Source code in toolboxv2/utils/extras/mkdocs.py
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | |
save(force=False)
async
¶Save index with atomic write pattern.
Source code in toolboxv2/utils/extras/mkdocs.py
898 899 900 901 902 903 904 905 906 907 | |
update_element(element_id, element)
¶Update or add code element with inverted index update.
Source code in toolboxv2/utils/extras/mkdocs.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 | |
update_section(section)
¶Update or add section with inverted index update.
Source code in toolboxv2/utils/extras/mkdocs.py
1078 1079 1080 1081 1082 1083 1084 1085 1086 | |
InvertedIndex
dataclass
¶
Inverted index for fast keyword lookups.
Source code in toolboxv2/utils/extras/mkdocs.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
clear()
¶Clear all indexes.
Source code in toolboxv2/utils/extras/mkdocs.py
126 127 128 129 130 131 132 133 | |
JSTSAnalyzer
¶
Regex-based analyzer for JavaScript and TypeScript files.
Source code in toolboxv2/utils/extras/mkdocs.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
analyze(file_path, use_cache=True)
¶Analyze JS/TS file for code elements.
Source code in toolboxv2/utils/extras/mkdocs.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
clear_cache()
¶Clear analyzer cache.
Source code in toolboxv2/utils/extras/mkdocs.py
763 764 765 | |
ParserState
¶
Parser states for state machine.
Source code in toolboxv2/utils/extras/mkdocs.py
173 174 175 176 177 178 | |
add_to_app(app, docs_root='../docs', include_dirs=None)
¶
Add docs system to ToolBoxV2 app.
Source code in toolboxv2/utils/extras/mkdocs.py
2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 | |
create_docs_system(project_root='.', docs_root='../docs', include_dirs=None, exclude_dirs=None)
¶
Factory function for DocsSystem.
Source code in toolboxv2/utils/extras/mkdocs.py
2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 | |
notification
¶
Cross-Platform Notification System¶
Supports multiple notification backends: - Windows: Toast notifications (PowerShell/win10toast) or MessageBox fallback - macOS: osascript notifications - Linux: notify-send (libnotify) - Tkinter: Cross-platform fallback with rich features - Web/Tauri: WebSocket-based notifications for Tauri desktop apps
Web/Tauri Integration: The notification system can send notifications to connected Tauri clients via WebSocket. The frontend DesktopStatusBar component receives these messages and triggers native Tauri notifications.
Usage:
notifier = NotificationSystem()
notifier.set_ws_bridge(app._zmq_ws_bridge) # Set WebSocket bridge
# Send to all connected web clients
await notifier.show_web_notification(
title="Update Available",
message="A new version is ready",
level="info"
)
# Send to specific connection
await notifier.show_web_notification(
title="Task Complete",
message="Your export is ready",
conn_id="user-123"
)
NotificationAction
dataclass
¶
Represents an action button in a notification
Source code in toolboxv2/utils/extras/notification.py
54 55 56 57 58 59 60 | |
NotificationDetails
dataclass
¶
Expandable details for notifications
Source code in toolboxv2/utils/extras/notification.py
63 64 65 66 67 68 | |
NotificationPosition
¶
Position options for notifications
Source code in toolboxv2/utils/extras/notification.py
79 80 81 82 83 84 85 86 87 88 89 | |
NotificationSystem
¶
Cross-platform notification system with OS integration, tkinter fallback, and Web/Tauri support via WebSocket.
Supports
- Native OS notifications (Windows, macOS, Linux)
- Tkinter fallback for rich notifications with actions
- Web/Tauri notifications via WebSocket bridge
Web/Tauri Usage: notifier = NotificationSystem() notifier.set_ws_bridge(ws_bridge) # From ws_bridge.py
# Async notification to web clients
await notifier.show_web_notification("Title", "Message")
# Or use the sync wrapper
notifier.notify_web("Title", "Message", conn_id="user-123")
Source code in toolboxv2/utils/extras/notification.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | |
has_ws_bridge()
¶Check if WebSocket bridge is configured.
Source code in toolboxv2/utils/extras/notification.py
261 262 263 | |
notify_web(title, message, notification_type=NotificationType.INFO, conn_id=None, channel=None, icon=None)
¶Synchronous wrapper for show_web_notification.
Sends a notification to connected Tauri/Web clients. This method handles the async call internally, making it easy to use from synchronous code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Notification title |
required |
message
|
str
|
Notification body/message |
required |
notification_type
|
NotificationType
|
Type of notification |
INFO
|
conn_id
|
str | None
|
Send to specific connection only (optional) |
None
|
channel
|
str | None
|
Broadcast to all connections in channel (optional) |
None
|
icon
|
str | None
|
Custom icon path (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if notification was sent successfully |
Example
notifier.notify_web("Task Complete", "Export finished!", NotificationType.SUCCESS)
Source code in toolboxv2/utils/extras/notification.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
set_default_position(position)
¶Set default position for notifications
Source code in toolboxv2/utils/extras/notification.py
237 238 239 | |
set_default_timeout(timeout_ms)
¶Set default timeout for notifications
Source code in toolboxv2/utils/extras/notification.py
223 224 225 226 227 228 229 230 | |
set_max_timeout(max_timeout_ms)
¶Set maximum allowed timeout
Source code in toolboxv2/utils/extras/notification.py
232 233 234 235 | |
set_ws_bridge(ws_bridge)
¶Set the WebSocket bridge for sending notifications to Tauri clients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws_bridge
|
ZMQWSBridge instance from toolboxv2.utils.workers.ws_bridge |
required |
Example
from toolboxv2.utils.workers.ws_bridge import ZMQWSBridge
bridge = ZMQWSBridge(event_manager, worker_id) notifier = NotificationSystem() notifier.set_ws_bridge(bridge)
Source code in toolboxv2/utils/extras/notification.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
show_notification(title, message, notification_type=NotificationType.INFO, actions=None, details=None, timeout=None, play_sound=False, position=None)
¶Show a notification with optional actions and details
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Title of the notification |
required |
message
|
str
|
Main message of the notification |
required |
notification_type
|
NotificationType
|
Type of notification |
INFO
|
actions
|
List[NotificationAction]
|
List of action buttons |
None
|
details
|
NotificationDetails
|
Expandable details |
None
|
timeout
|
int
|
Timeout in milliseconds |
None
|
play_sound
|
bool
|
Whether to play a sound |
False
|
position
|
NotificationPosition
|
Position on screen |
None
|
Returns the ID of the selected action, or None if dismissed
Source code in toolboxv2/utils/extras/notification.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
show_web_notification(title, message, notification_type=NotificationType.INFO, conn_id=None, channel=None, icon=None)
async
¶Send a notification to connected Tauri/Web clients via WebSocket.
The notification is sent as a JSON message that the frontend DesktopStatusBar component recognizes and displays using Tauri's native notification API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Notification title |
required |
message
|
str
|
Notification body/message |
required |
notification_type
|
NotificationType
|
Type of notification (affects icon/styling) |
INFO
|
conn_id
|
str | None
|
Send to specific connection only (optional) |
None
|
channel
|
str | None
|
Broadcast to all connections in channel (optional) |
None
|
icon
|
str | None
|
Custom icon path (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if notification was sent successfully, False otherwise |
Routing
- If conn_id is provided: sends only to that connection
- If channel is provided: broadcasts to all in that channel
- If neither: broadcasts to ALL connected clients
Example
Send to all connected clients¶
await notifier.show_web_notification( title="System Update", message="Server restarting in 5 minutes", notification_type=NotificationType.WARNING )
Send to specific user¶
await notifier.show_web_notification( title="Download Ready", message="Your file is ready for download", conn_id="user-session-123" )
Source code in toolboxv2/utils/extras/notification.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
NotificationType
¶
Types of notifications
Source code in toolboxv2/utils/extras/notification.py
71 72 73 74 75 76 77 | |
ask_question(title, message, yes_callback=None, no_callback=None, **kwargs)
¶
Ask a yes/no question
Source code in toolboxv2/utils/extras/notification.py
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
create_notification_system()
¶
Create and return a notification system instance
Source code in toolboxv2/utils/extras/notification.py
996 997 998 | |
example_notifications()
¶
Example notification scenarios with better timing
Source code in toolboxv2/utils/extras/notification.py
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | |
quick_error(title, message, **kwargs)
¶
Quick error notification
Source code in toolboxv2/utils/extras/notification.py
1019 1020 1021 1022 | |
quick_info(title, message, **kwargs)
¶
Quick info notification
Source code in toolboxv2/utils/extras/notification.py
1001 1002 1003 1004 | |
quick_success(title, message, **kwargs)
¶
Quick success notification
Source code in toolboxv2/utils/extras/notification.py
1007 1008 1009 1010 | |
quick_warning(title, message, **kwargs)
¶
Quick warning notification
Source code in toolboxv2/utils/extras/notification.py
1013 1014 1015 1016 | |
setup_web_notifications(ws_bridge)
¶
Configure the notification system for Web/Tauri notifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws_bridge
|
ZMQWSBridge instance from toolboxv2.utils.workers.ws_bridge |
required |
Returns:
| Type | Description |
|---|---|
NotificationSystem
|
Configured NotificationSystem instance |
Example
from toolboxv2.utils.workers.ws_bridge import install_ws_bridge from toolboxv2.utils.extras.notification import setup_web_notifications
In your worker setup:¶
bridge = install_ws_bridge(app, event_manager, worker_id) notifier = setup_web_notifications(bridge)
Now you can send web notifications:¶
notifier.notify_web("Hello", "World!")
Source code in toolboxv2/utils/extras/notification.py
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | |
web_notify(title, message, notification_type=NotificationType.INFO, conn_id=None, channel=None)
async
¶
Send a notification to connected Tauri/Web clients (async).
Requires setup_web_notifications() to be called first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Notification title |
required |
message
|
str
|
Notification body |
required |
notification_type
|
NotificationType
|
Type of notification |
INFO
|
conn_id
|
str | None
|
Send to specific connection (optional) |
None
|
channel
|
str | None
|
Broadcast to channel (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if sent successfully |
Example
await web_notify("Update", "New version available", NotificationType.INFO)
Source code in toolboxv2/utils/extras/notification.py
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
web_notify_sync(title, message, notification_type=NotificationType.INFO, conn_id=None, channel=None)
¶
Send a notification to connected Tauri/Web clients (sync wrapper).
Requires setup_web_notifications() to be called first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Notification title |
required |
message
|
str
|
Notification body |
required |
notification_type
|
NotificationType
|
Type of notification |
INFO
|
conn_id
|
str | None
|
Send to specific connection (optional) |
None
|
channel
|
str | None
|
Broadcast to channel (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if sent successfully |
Example
web_notify_sync("Task Done", "Export complete", NotificationType.SUCCESS)
Source code in toolboxv2/utils/extras/notification.py
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | |
reqbuilder
¶
generate_requirements(folder, output_file)
¶
Generates requirements.txt for the specified folder using pipreqs.
Source code in toolboxv2/utils/extras/reqbuilder.py
7 8 9 10 11 12 13 14 15 16 17 18 19 | |
run_pipeline(base_dir)
¶
Runs the entire pipeline to generate requirements files.
Source code in toolboxv2/utils/extras/reqbuilder.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
install_support
¶
Complete TB Language Setup - Build executable from Rust source - Setup file associations (.tbx and .tb) - Install VS Code extension - Install PyCharm plugin - Configure system PATH
Version: 1.0.1 Last Updated: 2025-11-10
TBSetup
¶
Complete TB Language setup manager
Source code in toolboxv2/utils/tbx/install_support.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
build_executable()
¶
Step 1: Build TB Language from Rust source
Source code in toolboxv2/utils/tbx/install_support.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
build_pycharm_plugin()
¶
Build PyCharm plugin JAR
Source code in toolboxv2/utils/tbx/install_support.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
create_pycharm_plugin()
¶
Create PyCharm plugin structure
Source code in toolboxv2/utils/tbx/install_support.py
268 269 270 271 272 273 274 275 276 277 | |
find_pycharm_config_dirs()
¶
Find PyCharm config directories
Source code in toolboxv2/utils/tbx/install_support.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
install_pycharm_plugin()
¶
Install plugin to PyCharm
Source code in toolboxv2/utils/tbx/install_support.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
setup_all()
¶
Run complete setup
Source code in toolboxv2/utils/tbx/install_support.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
setup_pycharm()
¶
Step 4: PyCharm plugin
Source code in toolboxv2/utils/tbx/install_support.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
setup_system_integration()
¶
Step 2: System integration (file associations)
Source code in toolboxv2/utils/tbx/install_support.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
setup_vscode()
¶
Step 3: VS Code extension
Source code in toolboxv2/utils/tbx/install_support.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
main()
¶
Main entry point
Source code in toolboxv2/utils/tbx/install_support.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
proxy
¶
ProxyUtil
¶
Source code in toolboxv2/utils/proxy/prox_util.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/proxy/prox_util.py
20 21 22 23 24 25 26 | |
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/proxy/prox_util.py
28 29 30 31 32 33 34 | |
prox_util
¶
ProxyUtil
¶
Source code in toolboxv2/utils/proxy/prox_util.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/proxy/prox_util.py
20 21 22 23 24 25 26 | |
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/proxy/prox_util.py
28 29 30 31 32 33 34 | |
security
¶
Code
¶
Source code in toolboxv2/utils/security/cryp.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
generate_random_string(length)
staticmethod
¶
Generiert eine zufällige Zeichenkette der angegebenen Länge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
Die Länge der zu generierenden Zeichenkette. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Die generierte Zeichenkette. |
Source code in toolboxv2/utils/security/cryp.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
114 115 116 117 118 119 120 121 122 | |
generate_symmetric_key(as_str=True)
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str or bytes
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
433 434 435 436 437 438 439 440 441 442 443 444 445 | |
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
cryp
¶
Code
¶
Source code in toolboxv2/utils/security/cryp.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
encrypt_asymmetric(text, public_key_str)
staticmethod
¶Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
encrypt_symmetric(text, key)
staticmethod
¶Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
generate_asymmetric_keys()
staticmethod
¶Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
generate_random_string(length)
staticmethod
¶Generiert eine zufällige Zeichenkette der angegebenen Länge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
Die Länge der zu generierenden Zeichenkette. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Die generierte Zeichenkette. |
Source code in toolboxv2/utils/security/cryp.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
generate_seed()
staticmethod
¶Erzeugt eine zufällige Zahl als Seed.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
114 115 116 117 118 119 120 121 122 | |
generate_symmetric_key(as_str=True)
staticmethod
¶Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str or bytes
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
load_keys_from_files(directory='keys')
staticmethod
¶Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
one_way_hash(text, salt='', pepper='')
staticmethod
¶Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
pem_to_public_key(pem_key)
staticmethod
¶Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
433 434 435 436 437 438 439 440 441 442 443 444 445 | |
public_key_to_pem(public_key)
staticmethod
¶Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
singelton_class
¶
Singleton
¶
Singleton metaclass for ensuring only one instance of a class.
Source code in toolboxv2/utils/singelton_class.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
system
¶
AppType
¶
Source code in toolboxv2/utils/system/types.py
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
debug
property
writable
¶
proxi attr
a_exit()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2080 2081 | |
a_fuction_runner(function, function_data, args, kwargs)
async
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2145 2146 2147 2148 2149 2150 2151 2152 2153 | |
a_remove_mod(mod_name, spec='app', delete=True)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2071 2072 | |
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2173 2174 2175 2176 2177 2178 | |
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
debug_rains(e)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1964 1965 | |
disconnect(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1952 1953 1954 | |
docs_init(force_rebuild=False)
async
¶
mkdocs system [extra] Returns:
Source code in toolboxv2/utils/system/types.py
2427 2428 2429 2430 2431 | |
docs_lookup(name=None, element_type=None, file_path=None, language=None, include_code=False, max_results=25)
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2410 2411 2412 2413 2414 2415 2416 2417 2418 | |
docs_reader(query=None, section_id=None, file_path=None, tags=None, max_results=25, format_type='structured')
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | |
docs_suggestions(max_suggestions=20)
async
¶
mkdocs system [extra] Returns: {"suggestions": [{"type": "unclear_section", "section_id": "123", "title": "Section Title", "priority": "low"}, ...], "total": 100, "time_ms": 123}
Source code in toolboxv2/utils/system/types.py
2419 2420 2421 2422 2423 | |
docs_sync()
async
¶
"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2425 2426 | |
docs_writer(action, **kwargs)
async
¶
"mkdocs system [extra] Actions: - create_file Kwargs: file_path, content Returns: {"status": "created", "file": file_path, "sections": num_sections} - add_section Kwargs: file_path, section_title, content, position, level Returns: {"status": "added", "section": section_id} - update_section Kwargs: section_id, content Returns: {"status": "updated", "section": section_id} - delete_section Kwargs: section_id Returns: {"status": "deleted", "section": section_id}
on error
Returns: {"error": "error_message"}
Source code in toolboxv2/utils/system/types.py
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | |
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶
Execute all functions with parallel processing and optional profiling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | |
exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2074 2075 | |
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1940 1941 1942 | |
footprint(update_tracking=True)
¶
Erfasst den aktuellen Ressourcen-Footprint der Toolbox-Instanz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update_tracking
|
bool
|
Wenn True, aktualisiert Min/Max/Avg-Tracking |
True
|
Returns:
| Type | Description |
|---|---|
FootprintMetrics
|
FootprintMetrics mit allen erfassten Metriken |
Source code in toolboxv2/utils/system/types.py
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | |
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2135 2136 2137 2138 2139 2140 2141 2142 2143 | |
generate_openapi_html()
¶
Generiert eine HTML-Datei mit OpenAPI/Swagger UI für API-Routen.
Args:
Source code in toolboxv2/utils/system/types.py
2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
get_all_mods(working_dir='mods', path_to='./runtime')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2045 2046 | |
get_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2372 2373 | |
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
2086 2087 2088 2089 2090 2091 2092 2093 2094 | |
get_mod(name, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2180 2181 | |
get_task_context(files, intent)
async
¶
mkdocs system [extra] Get optimized context for a specific editing task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[str]
|
List of file paths relevant to the task. |
required |
intent
|
str
|
Description of what the user wants to do (e.g., "Add logging to auth"). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
ContextBundle dictionary ready for LLM injection. |
Source code in toolboxv2/utils/system/types.py
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 | |
get_username(get_input=False, default='loot')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2375 2376 | |
hide_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1944 1945 1946 | |
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2011 2012 | |
load_all_mods_in_file(working_dir='mods')
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2042 2043 | |
load_external_mods()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2039 2040 | |
load_mod(mod_name, mlm='I', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2033 2034 | |
mod_online(mod_name, installed=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2020 2021 | |
print(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2183 2184 2185 | |
print_footprint(detailed=True)
¶
Gibt den Footprint formatiert aus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detailed
|
bool
|
Wenn True, zeigt alle Details, sonst nur Zusammenfassung |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Formatierter Footprint-String |
Source code in toolboxv2/utils/system/types.py
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | |
print_ok()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2058 2059 2060 | |
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2062 2063 | |
remove_mod(mod_name, spec='app', delete=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2068 2069 | |
rrun_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1973 1974 | |
run_a_from_sync(function, *args)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
2096 2097 2098 2099 | |
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2167 2168 2169 2170 2171 | |
run_bg_task(task)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
2111 2112 2113 2114 | |
run_bg_task_advanced(task, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2101 2102 2103 2104 | |
run_flows(name, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1970 1971 | |
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2115 2116 2117 2118 2119 2120 2121 2122 2123 | |
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶
run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | |
save_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2369 2370 | |
save_exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2030 2031 | |
save_initialized_module(tools_class, spec)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2017 2018 | |
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2014 2015 | |
save_load(modname, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2083 2084 | |
save_registry_as_enums(directory, filename)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2378 2379 | |
set_flows(r)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1967 1968 | |
set_logger(debug=False, logger_prefix=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1956 1957 | |
show_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1948 1949 1950 | |
sprint(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2187 2188 2189 | |
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None, websocket_handler=None, websocket_context=False)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | |
wait_for_bg_tasks(timeout=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2106 2107 2108 2109 | |
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
2065 2066 | |
web_context()
¶
returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
2077 2078 | |
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
174 175 176 177 178 179 180 | |
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
167 168 169 | |
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
164 165 | |
MainToolType
¶
Source code in toolboxv2/utils/system/types.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | |
load()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1402 1403 | |
print(message, end='\n', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1405 1406 | |
return_result(error=ToolBoxError.none, exec_code=0, help_text='', data_info=None, data=None, data_to=None)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | |
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/types.py
1414 1415 | |
Result
¶
Source code in toolboxv2/utils/system/types.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__class_getitem__(item)
¶
Enable Result[Type] syntax
Source code in toolboxv2/utils/system/types.py
734 735 736 737 738 739 740 741 742 743 744 | |
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
cast_to(target_type)
¶
Cast result to different type
Source code in toolboxv2/utils/system/types.py
829 830 831 832 833 834 835 836 837 838 839 | |
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
| Type | Description |
|---|---|
|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | |
get_type_info()
¶
Get the generic type information
Source code in toolboxv2/utils/system/types.py
841 842 843 | |
is_typed()
¶
Check if result has type information
Source code in toolboxv2/utils/system/types.py
845 846 847 | |
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | |
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
| Type | Description |
|---|---|
|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
dict | None
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional function for cleanup. |
None
|
Returns:
| Type | Description |
|---|---|
|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
typed_aget(key=None, default=None)
async
¶
Async get data with type validation
Source code in toolboxv2/utils/system/types.py
758 759 760 761 762 763 764 765 766 767 | |
typed_get(key=None, default=None)
¶
Get data with type validation
Source code in toolboxv2/utils/system/types.py
746 747 748 749 750 751 752 753 754 755 756 | |
typed_json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create JSON result with type information
Source code in toolboxv2/utils/system/types.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
typed_ok(data, data_info='', info='OK', interface=ToolBoxInterfaces.native)
classmethod
¶
Create OK result with type information
Source code in toolboxv2/utils/system/types.py
796 797 798 799 800 801 802 803 804 805 806 807 | |
all_functions_enums
¶
Automatic generated by ToolBox v = 0.1.22
main_tool
¶
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
174 175 176 177 178 179 180 | |
get_version()
¶"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
167 168 169 | |
webInstall(user_instance, construct_render)
¶"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
164 165 | |
get_version_from_pyproject(pyproject_path='../pyproject.toml')
¶
Reads the version from the pyproject.toml file.
Source code in toolboxv2/utils/system/main_tool.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
session
¶
ToolBox V2 - Session Management Handles CLI and API sessions with Clerk integration
RequestSession
¶
Wrapper for request session data
Source code in toolboxv2/utils/system/session.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
Session
¶
Session manager for ToolBox V2 with Clerk integration. Handles authentication tokens and API communication.
Source code in toolboxv2/utils/system/session.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
cleanup()
async
¶Cleanup session resources
Source code in toolboxv2/utils/system/session.py
403 404 405 406 407 408 409 410 411 412 | |
download_file(url, dest_folder='mods_sto')
async
¶Download file from URL
Source code in toolboxv2/utils/system/session.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
exit()
¶Exit and clear session (legacy compatibility)
Source code in toolboxv2/utils/system/session.py
414 415 416 | |
fetch(url, method='GET', data=None, json=None, **kwargs)
async
¶Fetch URL with authentication
Source code in toolboxv2/utils/system/session.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
init()
¶Initialize session (legacy compatibility)
Source code in toolboxv2/utils/system/session.py
279 280 281 | |
login(verbose=False)
async
¶Login using stored Clerk session token. Returns True if session is valid.
Source code in toolboxv2/utils/system/session.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
login_with_code(email, code)
async
¶Login with email verification code (Clerk Email + Code flow). This is the primary CLI login method.
Source code in toolboxv2/utils/system/session.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
logout()
async
¶Logout and clear session
Source code in toolboxv2/utils/system/session.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
set_token(token)
¶Set session token (for web login callback)
Source code in toolboxv2/utils/system/session.py
283 284 285 | |
upload_file(file_path, upload_url)
async
¶Upload file to URL
Source code in toolboxv2/utils/system/session.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
get_local_ip()
¶
Get local IP address
Source code in toolboxv2/utils/system/session.py
431 432 433 434 435 436 437 438 439 | |
get_public_ip()
¶
Get public IP address
Source code in toolboxv2/utils/system/session.py
421 422 423 424 425 426 427 428 | |
test_session()
¶
Run session tests
Source code in toolboxv2/utils/system/session.py
452 453 454 | |
state_system
¶
The Task of the State System is : 1 Kep trak of the current state of the ToolBox and its dependency's 2 tracks the shasum of all mod and runnabael 3 the version of all mod
The state : {"utils":{"file_name": {"version":##,"shasum"}} ,"mods":{"file_name": {"version":##,"shasum":##,"src-url":##}} ,"runnable":{"file_name": {"version":##,"shasum":##,"src-url":##}} ,"api":{"file_name": {"version":##,"shasum"}} ,"app":{"file_name": {"version":##,"shasum":##,"src-url":##}} }
trans form state from on to an other.
detect_os_and_arch()
¶
Detect the current operating system and architecture.
Source code in toolboxv2/utils/system/state_system.py
298 299 300 301 302 | |
download_executable(url, file_name)
¶
Attempt to download the executable from the provided URL.
Source code in toolboxv2/utils/system/state_system.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
find_highest_zip_version(name_filter, app_version=None, root_dir='mods_sto', version_only=False)
¶
Findet die höchste verfügbare ZIP-Version in einem Verzeichnis basierend auf einem Namensfilter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_dir
|
str
|
Wurzelverzeichnis für die Suche |
'mods_sto'
|
name_filter
|
str
|
Namensfilter für die ZIP-Dateien |
required |
app_version
|
str
|
Aktuelle App-Version für Kompatibilitätsprüfung |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Pfad zur ZIP-Datei mit der höchsten Version oder None wenn keine gefunden |
Source code in toolboxv2/utils/system/state_system.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
find_highest_zip_version_entry(name, target_app_version=None, filepath='tbState.yaml')
¶
Findet den Eintrag mit der höchsten ZIP-Version für einen gegebenen Namen und eine optionale Ziel-App-Version in einer YAML-Datei.
:param name: Der Name des gesuchten Eintrags. :param target_app_version: Die Zielversion der App als String (optional). :param filepath: Der Pfad zur YAML-Datei. :return: Den Eintrag mit der höchsten ZIP-Version innerhalb der Ziel-App-Version oder None, falls nicht gefunden.
Source code in toolboxv2/utils/system/state_system.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
query_executable_url(current_os, machine)
¶
Query a remote URL for a matching executable based on OS and architecture. The file name is built dynamically based on parameters.
Source code in toolboxv2/utils/system/state_system.py
305 306 307 308 309 310 311 312 313 314 315 316 317 | |
types
¶
AppType
¶
Source code in toolboxv2/utils/system/types.py
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
debug
property
writable
¶proxi attr
a_exit()
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2080 2081 | |
a_fuction_runner(function, function_data, args, kwargs)
async
¶parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2145 2146 2147 2148 2149 2150 2151 2152 2153 | |
a_remove_mod(mod_name, spec='app', delete=True)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2071 2072 | |
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2173 2174 2175 2176 2177 2178 | |
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
debug_rains(e)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1964 1965 | |
disconnect(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1952 1953 1954 | |
docs_init(force_rebuild=False)
async
¶mkdocs system [extra] Returns:
Source code in toolboxv2/utils/system/types.py
2427 2428 2429 2430 2431 | |
docs_lookup(name=None, element_type=None, file_path=None, language=None, include_code=False, max_results=25)
async
¶"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2410 2411 2412 2413 2414 2415 2416 2417 2418 | |
docs_reader(query=None, section_id=None, file_path=None, tags=None, max_results=25, format_type='structured')
async
¶"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | |
docs_suggestions(max_suggestions=20)
async
¶mkdocs system [extra] Returns: {"suggestions": [{"type": "unclear_section", "section_id": "123", "title": "Section Title", "priority": "low"}, ...], "total": 100, "time_ms": 123}
Source code in toolboxv2/utils/system/types.py
2419 2420 2421 2422 2423 | |
docs_sync()
async
¶"mkdocs system [extra]
Source code in toolboxv2/utils/system/types.py
2425 2426 | |
docs_writer(action, **kwargs)
async
¶"mkdocs system [extra] Actions: - create_file Kwargs: file_path, content Returns: {"status": "created", "file": file_path, "sections": num_sections} - add_section Kwargs: file_path, section_title, content, position, level Returns: {"status": "added", "section": section_id} - update_section Kwargs: section_id, content Returns: {"status": "updated", "section": section_id} - delete_section Kwargs: section_id Returns: {"status": "deleted", "section": section_id}
on error
Returns: {"error": "error_message"}
Source code in toolboxv2/utils/system/types.py
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | |
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶Execute all functions with parallel processing and optional profiling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | |
exit()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2074 2075 | |
exit_main(*args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1940 1941 1942 | |
footprint(update_tracking=True)
¶Erfasst den aktuellen Ressourcen-Footprint der Toolbox-Instanz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update_tracking
|
bool
|
Wenn True, aktualisiert Min/Max/Avg-Tracking |
True
|
Returns:
| Type | Description |
|---|---|
FootprintMetrics
|
FootprintMetrics mit allen erfassten Metriken |
Source code in toolboxv2/utils/system/types.py
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | |
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
2135 2136 2137 2138 2139 2140 2141 2142 2143 | |
generate_openapi_html()
¶Generiert eine HTML-Datei mit OpenAPI/Swagger UI für API-Routen.
Args:
Source code in toolboxv2/utils/system/types.py
2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | |
get_all_mods(working_dir='mods', path_to='./runtime')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2045 2046 | |
get_autocompletion_dict()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2372 2373 | |
get_function(name, **kwargs)
¶Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
2086 2087 2088 2089 2090 2091 2092 2093 2094 | |
get_mod(name, spec='app')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2180 2181 | |
get_task_context(files, intent)
async
¶mkdocs system [extra] Get optimized context for a specific editing task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
List[str]
|
List of file paths relevant to the task. |
required |
intent
|
str
|
Description of what the user wants to do (e.g., "Add logging to auth"). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
ContextBundle dictionary ready for LLM injection. |
Source code in toolboxv2/utils/system/types.py
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 | |
get_username(get_input=False, default='loot')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2375 2376 | |
hide_console(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1944 1945 1946 | |
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2011 2012 | |
load_all_mods_in_file(working_dir='mods')
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2042 2043 | |
load_external_mods()
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2039 2040 | |
load_mod(mod_name, mlm='I', **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2033 2034 | |
mod_online(mod_name, installed=False)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2020 2021 | |
print(text, *args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2183 2184 2185 | |
print_footprint(detailed=True)
¶Gibt den Footprint formatiert aus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detailed
|
bool
|
Wenn True, zeigt alle Details, sonst nur Zusammenfassung |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Formatierter Footprint-String |
Source code in toolboxv2/utils/system/types.py
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | |
print_ok()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2058 2059 2060 | |
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2062 2063 | |
remove_mod(mod_name, spec='app', delete=True)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2068 2069 | |
rrun_flows(name, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1973 1974 | |
run_a_from_sync(function, *args)
¶run a async fuction
Source code in toolboxv2/utils/system/types.py
2096 2097 2098 2099 | |
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2167 2168 2169 2170 2171 | |
run_bg_task(task)
¶run a async fuction
Source code in toolboxv2/utils/system/types.py
2111 2112 2113 2114 | |
run_bg_task_advanced(task, *args, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2101 2102 2103 2104 | |
run_flows(name, **kwargs)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1970 1971 | |
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2115 2116 2117 2118 2119 2120 2121 2122 2123 | |
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | |
save_autocompletion_dict()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2369 2370 | |
save_exit()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2030 2031 | |
save_initialized_module(tools_class, spec)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2017 2018 | |
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2014 2015 | |
save_load(modname, spec='app')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2083 2084 | |
save_registry_as_enums(directory, filename)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2378 2379 | |
set_flows(r)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1967 1968 | |
set_logger(debug=False, logger_prefix=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1956 1957 | |
show_console(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1948 1949 1950 | |
sprint(text, *args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2187 2188 2189 | |
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None, websocket_handler=None, websocket_context=False)
¶A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | |
wait_for_bg_tasks(timeout=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2106 2107 2108 2109 | |
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
2065 2066 | |
web_context()
¶returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
2077 2078 | |
FootprintMetrics
dataclass
¶
Dataclass für Footprint-Metriken
Source code in toolboxv2/utils/system/types.py
1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | |
to_dict()
¶Konvertiert Metriken in Dictionary
Source code in toolboxv2/utils/system/types.py
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | |
Headers
¶
Class representing HTTP headers with strongly typed common fields.
Source code in toolboxv2/utils/system/types.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
__post_init__()
¶Convert header keys with hyphens to underscores for attribute access.
Source code in toolboxv2/utils/system/types.py
160 161 162 163 164 165 166 167 168 169 170 171 | |
from_dict(headers_dict)
classmethod
¶Create a Headers instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
to_dict()
¶Convert the Headers object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
MainToolType
¶
Source code in toolboxv2/utils/system/types.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | |
load()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1402 1403 | |
print(message, end='\n', **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1405 1406 | |
return_result(error=ToolBoxError.none, exec_code=0, help_text='', data_info=None, data=None, data_to=None)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | |
webInstall(user_instance, construct_render)
¶"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/types.py
1414 1415 | |
Request
¶
Class representing an HTTP request.
Source code in toolboxv2/utils/system/types.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
from_dict(data)
classmethod
¶Create a Request instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
to_dict()
¶Convert the Request object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
RequestData
¶
Main class representing the complete request data structure.
Source code in toolboxv2/utils/system/types.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
__getattr__(name)
¶Delegate unknown attributes to the request object.
Source code in toolboxv2/utils/system/types.py
413 414 415 416 417 418 419 | |
from_dict(data)
classmethod
¶Create a RequestData instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
396 397 398 399 400 401 402 403 | |
to_dict()
¶Convert the RequestData object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
405 406 407 408 409 410 411 | |
Result
¶
Source code in toolboxv2/utils/system/types.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__class_getitem__(item)
¶Enable Result[Type] syntax
Source code in toolboxv2/utils/system/types.py
734 735 736 737 738 739 740 741 742 743 744 | |
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
cast_to(target_type)
¶Cast result to different type
Source code in toolboxv2/utils/system/types.py
829 830 831 832 833 834 835 836 837 838 839 | |
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a file download response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
| Type | Description |
|---|---|
|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | |
get_type_info()
¶Get the generic type information
Source code in toolboxv2/utils/system/types.py
841 842 843 | |
is_typed()
¶Check if result has type information
Source code in toolboxv2/utils/system/types.py
845 846 847 | |
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | |
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a redirect response.
Source code in toolboxv2/utils/system/types.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
| Type | Description |
|---|---|
|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶Create a streaming response Result. Handles SSE and other stream types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
dict | None
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional function for cleanup. |
None
|
Returns:
| Type | Description |
|---|---|
|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
typed_aget(key=None, default=None)
async
¶Async get data with type validation
Source code in toolboxv2/utils/system/types.py
758 759 760 761 762 763 764 765 766 767 | |
typed_get(key=None, default=None)
¶Get data with type validation
Source code in toolboxv2/utils/system/types.py
746 747 748 749 750 751 752 753 754 755 756 | |
typed_json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶Create JSON result with type information
Source code in toolboxv2/utils/system/types.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
typed_ok(data, data_info='', info='OK', interface=ToolBoxInterfaces.native)
classmethod
¶Create OK result with type information
Source code in toolboxv2/utils/system/types.py
796 797 798 799 800 801 802 803 804 805 806 807 | |
SSEGenerator
¶
Production-ready SSE generator that converts any data source to properly formatted Server-Sent Events compatible with browsers.
Source code in toolboxv2/utils/system/types.py
2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 | |
create_sse_stream(source, cleanup_func=None)
async
classmethod
¶Convert any source to a properly formatted SSE stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Can be async generator, sync generator, iterable, or a single item. |
required |
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional function to call when the stream ends or is cancelled. Can be a synchronous function, async function, or async generator. |
None
|
Yields:
| Type | Description |
|---|---|
AsyncGenerator[str, None]
|
Properly formatted SSE messages (strings). |
Source code in toolboxv2/utils/system/types.py
2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 | |
format_sse_event(data)
staticmethod
¶Format any data as a proper SSE event message.
Source code in toolboxv2/utils/system/types.py
2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 | |
wrap_sync_generator(generator)
async
classmethod
¶Convert a synchronous generator to an async generator.
Source code in toolboxv2/utils/system/types.py
2979 2980 2981 2982 2983 2984 2985 | |
Session
¶
Class representing a session.
This class is compatible with both legacy session format and the new SessionData format from the worker system.
Legacy fields (for backwards compatibility): - SiID: Session ID (alias for session_id) - level: Permission level (can be str or int) - spec: User specification/role - user_name: Username - extra_data: Additional data
New fields (from SessionData): - user_id: User identifier - session_id: Session identifier - clerk_user_id: Clerk user ID - validated: Whether session was validated - anonymous: Whether session is anonymous
Source code in toolboxv2/utils/system/types.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
is_authenticated
property
¶Check if session represents an authenticated user (compatible with SessionData).
valid
property
¶Check if session is valid (level > 0 or validated).
from_dict(data)
classmethod
¶Create a Session instance from a dictionary with default values.
Source code in toolboxv2/utils/system/types.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
from_session_data(session_data)
classmethod
¶Create a Session from a SessionData object (from worker system).
This allows seamless conversion from the worker's SessionData to the legacy Session format used by modules.
Source code in toolboxv2/utils/system/types.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
to_dict()
¶Convert the Session object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
WebSocketContext
¶
Context object passed to WebSocket handlers. Contains connection information and authenticated session data.
Source code in toolboxv2/utils/system/types.py
1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | |
is_authenticated
property
¶Returns True if the connection has a valid user ID.
user_id
property
¶Helper to get the user ID agnostic of key naming.
from_kwargs(kwargs)
classmethod
¶Creates a WebSocketContext robustly from arguments passed by Rust. Rust passes 'session_data' (stored context) and request info.
Source code in toolboxv2/utils/system/types.py
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 | |
parse_request_data(data)
¶
Parse the incoming request data into a strongly typed structure.
Source code in toolboxv2/utils/system/types.py
469 470 471 | |
tbx
¶
install_support
¶
Complete TB Language Setup - Build executable from Rust source - Setup file associations (.tbx and .tb) - Install VS Code extension - Install PyCharm plugin - Configure system PATH
Version: 1.0.1 Last Updated: 2025-11-10
TBSetup
¶
Complete TB Language setup manager
Source code in toolboxv2/utils/tbx/install_support.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
build_executable()
¶Step 1: Build TB Language from Rust source
Source code in toolboxv2/utils/tbx/install_support.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
build_pycharm_plugin()
¶Build PyCharm plugin JAR
Source code in toolboxv2/utils/tbx/install_support.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
create_pycharm_plugin()
¶Create PyCharm plugin structure
Source code in toolboxv2/utils/tbx/install_support.py
268 269 270 271 272 273 274 275 276 277 | |
find_pycharm_config_dirs()
¶Find PyCharm config directories
Source code in toolboxv2/utils/tbx/install_support.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
install_pycharm_plugin()
¶Install plugin to PyCharm
Source code in toolboxv2/utils/tbx/install_support.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
setup_all()
¶Run complete setup
Source code in toolboxv2/utils/tbx/install_support.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
setup_pycharm()
¶Step 4: PyCharm plugin
Source code in toolboxv2/utils/tbx/install_support.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
setup_system_integration()
¶Step 2: System integration (file associations)
Source code in toolboxv2/utils/tbx/install_support.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
setup_vscode()
¶Step 3: VS Code extension
Source code in toolboxv2/utils/tbx/install_support.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
main()
¶
Main entry point
Source code in toolboxv2/utils/tbx/install_support.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
setup
¶
TB Language Setup Utility - File association (.tbx and .tb files) - Icon registration - Desktop integration - System PATH configuration
Version: 1.0.1 Last Updated: 2025-11-10
TBxSetup
¶
Setup utility for TB Language file associations and icons
Source code in toolboxv2/utils/tbx/setup.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
get_executable()
¶Get TB executable path
Source code in toolboxv2/utils/tbx/setup.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
get_icon_path()
¶Get icon file path
Source code in toolboxv2/utils/tbx/setup.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
get_tb_root()
¶Get toolbox root directory
Source code in toolboxv2/utils/tbx/setup.py
30 31 32 33 34 35 36 37 | |
setup_all()
¶Run complete setup
Source code in toolboxv2/utils/tbx/setup.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
setup_icon()
¶Setup icon file
Source code in toolboxv2/utils/tbx/setup.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
setup_linux()
¶Setup file association on Linux for .tbx and .tb files
Source code in toolboxv2/utils/tbx/setup.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
setup_macos()
¶Setup file association on macOS
Source code in toolboxv2/utils/tbx/setup.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
setup_windows()
¶Setup file association on Windows for .tbx and .tb files
Source code in toolboxv2/utils/tbx/setup.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
uninstall()
¶Remove file associations
Source code in toolboxv2/utils/tbx/setup.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
main()
¶
Main entry point
Source code in toolboxv2/utils/tbx/setup.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
test
¶
test_setup
¶
Test suite for TB Language setup scripts Tests setup.py and install_support.py functionality
Version: 1.0.1 Last Updated: 2025-11-10
TestPyCharmPlugin
¶Test PyCharm plugin configuration
Source code in toolboxv2/utils/tbx/test/test_setup.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
test_comment_syntax_correct()
¶Test that comment syntax is correct in TB.xml
Source code in toolboxv2/utils/tbx/test/test_setup.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
test_file_extensions_configured()
¶Test that both .tbx and .tb extensions are configured
Source code in toolboxv2/utils/tbx/test/test_setup.py
213 214 215 216 217 218 219 220 221 222 223 224 | |
test_filetype_xml_exists()
¶Test that TB.xml exists
Source code in toolboxv2/utils/tbx/test/test_setup.py
187 188 189 190 191 192 193 194 | |
test_plugin_xml_exists()
¶Test that plugin.xml exists
Source code in toolboxv2/utils/tbx/test/test_setup.py
178 179 180 181 182 183 184 185 | |
TestTBSetup
¶Test TBSetup class (complete installation)
Source code in toolboxv2/utils/tbx/test/test_setup.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
test_init()
¶Test TBSetup initialization
Source code in toolboxv2/utils/tbx/test/test_setup.py
61 62 63 64 65 66 67 | |
test_paths_exist()
¶Test that critical paths exist
Source code in toolboxv2/utils/tbx/test/test_setup.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
test_pycharm_plugin_path()
¶Test PyCharm plugin path
Source code in toolboxv2/utils/tbx/test/test_setup.py
95 96 97 98 99 100 101 102 103 | |
test_vscode_extension_path()
¶Test VS Code extension path
Source code in toolboxv2/utils/tbx/test/test_setup.py
84 85 86 87 88 89 90 91 92 93 | |
TestTBxSetup
¶Test TBxSetup class (file associations)
Source code in toolboxv2/utils/tbx/test/test_setup.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
test_get_executable()
¶Test executable path detection
Source code in toolboxv2/utils/tbx/test/test_setup.py
41 42 43 44 45 46 47 48 | |
test_get_icon_path()
¶Test icon path detection
Source code in toolboxv2/utils/tbx/test/test_setup.py
50 51 52 53 54 | |
test_get_tb_root()
¶Test TB root directory detection
Source code in toolboxv2/utils/tbx/test/test_setup.py
32 33 34 35 36 37 38 39 | |
test_init()
¶Test TBxSetup initialization
Source code in toolboxv2/utils/tbx/test/test_setup.py
24 25 26 27 28 29 30 | |
TestVSCodeExtension
¶Test VS Code extension configuration
Source code in toolboxv2/utils/tbx/test/test_setup.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
test_file_extensions_configured()
¶Test that both .tbx and .tb extensions are configured
Source code in toolboxv2/utils/tbx/test/test_setup.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
test_language_configuration_valid()
¶Test that language-configuration.json is valid
Source code in toolboxv2/utils/tbx/test/test_setup.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
test_package_json_valid()
¶Test that package.json is valid JSON
Source code in toolboxv2/utils/tbx/test/test_setup.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
test_syntax_file_valid()
¶Test that tb.tmLanguage.json is valid
Source code in toolboxv2/utils/tbx/test/test_setup.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
test_tb_lang2
¶
TB Language Comprehensive Test Suite Tests all features of the TB language implementation.
Usage
python test_tb_lang.py python test_tb_lang.py --verbose python test_tb_lang.py --filter "test_arithmetic" python test_tb_lang.py --mode jit python test_tb_lang.py --mode compiled python test_tb_lang.py --skip-slow
TestSuite
¶Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
load_failed_tests()
¶Load previously failed test names from cache.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
84 85 86 87 88 89 90 91 92 93 94 | |
save_failed_tests()
¶Save failed test names to cache.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
96 97 98 99 100 101 | |
should_run_test(test_name)
¶Check if test should run based on FAILED_ONLY flag.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
103 104 105 106 107 | |
assert_contains(code, substring, mode='jit')
¶Assert that output contains substring.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
401 402 403 404 405 406 407 408 409 | |
assert_error(code, mode='jit')
¶Assert that code fails.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
412 413 414 415 416 417 | |
assert_output(code, expected, mode='jit')
¶Assert that TB code produces expected output.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
assert_output_with_tcp_server(code, expected, mode='jit', host='localhost', port=8085)
¶Run code while a temporary TCP server is alive. The server accepts a single connection, reads once, then closes.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
assert_success(code, mode='jit')
¶Assert that TB code runs without error.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
388 389 390 391 392 393 394 395 396 397 398 | |
escape_path_for_tb(path)
¶Escape path for TB string literals.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
3899 3900 3901 | |
find_tb_binary()
¶Find TB binary in multiple locations.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
load_failed_tests()
¶Load failed test names from file.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
222 223 224 225 226 227 228 229 230 | |
save_failed_tests(failed_names)
¶Save failed test names to file.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
213 214 215 216 217 218 219 220 | |
test_plugin_python_state_persistence_classes(mode)
¶Test that class instances persist across function calls.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 | |
test_plugin_python_state_persistence_globals(mode)
¶CRITICAL TEST: Python plugins should maintain state between function calls.
Problem: Currently each function call creates a new Python module, so global variables are reset.
Expected: Global variables should persist across function calls.
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | |
test_plugin_python_state_persistence_toolboxv2(mode)
¶CRITICAL TEST: Real-world use case from fixes.md
The server plugin needs to maintain a single App instance across multiple function calls (get_app, list_modules, etc.)
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 | |
test_plugin_rust_compile_inline(mode)
¶Test compiling Rust plugins from inline code
Source code in toolboxv2/utils/tbx/test/test_tb_lang2.py
2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 | |
validate_documentation
¶
Validate TB Language documentation consistency Checks that all documentation is consistent with code changes
Version: 1.0.1 Last Updated: 2025-11-10
DocumentationValidator
¶Validates documentation consistency
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
check_comment_syntax_documented()
¶Check that comment syntax is correctly documented
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
check_execution_modes_documented()
¶Check that JIT and AOT execution modes are documented
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
check_file_extensions_documented()
¶Check that both .tbx and .tb extensions are documented
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
check_keywords_consistency()
¶Check that keywords are consistent across implementations
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
check_version_consistency()
¶Check that version numbers are consistent
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
run_all_checks()
¶Run all validation checks
Source code in toolboxv2/utils/tbx/test/validate_documentation.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
tbx_setup
¶
TB Language Setup Utility - File association (.tbx and .tb files) - Icon registration - Desktop integration - System PATH configuration
Version: 1.0.1 Last Updated: 2025-11-10
TBxSetup
¶
Setup utility for TB Language file associations and icons
Source code in toolboxv2/utils/tbx/setup.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
get_executable()
¶
Get TB executable path
Source code in toolboxv2/utils/tbx/setup.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
get_icon_path()
¶
Get icon file path
Source code in toolboxv2/utils/tbx/setup.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
get_tb_root()
¶
Get toolbox root directory
Source code in toolboxv2/utils/tbx/setup.py
30 31 32 33 34 35 36 37 | |
setup_all()
¶
Run complete setup
Source code in toolboxv2/utils/tbx/setup.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
setup_icon()
¶
Setup icon file
Source code in toolboxv2/utils/tbx/setup.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
setup_linux()
¶
Setup file association on Linux for .tbx and .tb files
Source code in toolboxv2/utils/tbx/setup.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
setup_macos()
¶
Setup file association on macOS
Source code in toolboxv2/utils/tbx/setup.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
setup_windows()
¶
Setup file association on Windows for .tbx and .tb files
Source code in toolboxv2/utils/tbx/setup.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
uninstall()
¶
Remove file associations
Source code in toolboxv2/utils/tbx/setup.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
main()
¶
Main entry point
Source code in toolboxv2/utils/tbx/setup.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
toolbox
¶
Main module.
App
¶
Source code in toolboxv2/utils/toolbox.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | |
disconnect(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
248 249 250 | |
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
236 237 238 | |
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/toolbox.py
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | |
hide_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
240 241 242 | |
init_mod(mod_name, spec='app')
¶
Initializes a module in a thread-safe manner by submitting the asynchronous initialization to the running event loop.
Source code in toolboxv2/utils/toolbox.py
647 648 649 650 651 652 653 654 | |
run(*args, mod_function_name=None, request=None, running_function_coro=None, **kwargs)
¶
Run a function with support for SSE streaming in both threaded and non-threaded contexts.
Source code in toolboxv2/utils/toolbox.py
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
run_bg_task(task, *args, **kwargs)
¶
Runs a coroutine in the background without blocking the caller.
This is the primary method for "fire-and-forget" async tasks. It schedules the coroutine to run on the application's main event loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Callable
|
The coroutine function to run. |
required |
*args
|
Arguments to pass to the coroutine function. |
()
|
|
**kwargs
|
Keyword arguments to pass to the coroutine function. |
{}
|
Returns:
| Type | Description |
|---|---|
Task | None
|
An asyncio.Task object representing the scheduled task, or None if |
Task | None
|
the task could not be scheduled. |
Source code in toolboxv2/utils/toolbox.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | |
run_bg_task_advanced(task, *args, get_coro=False, **kwargs)
¶
Runs a task in a separate, dedicated background thread with its own event loop.
This is ideal for: 1. Running an async task from a synchronous context. 2. Launching a long-running, independent operation that should not interfere with the main application's event loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Callable
|
The function to run (can be sync or async). |
required |
*args
|
Arguments for the task. |
()
|
|
**kwargs
|
Keyword arguments for the task. |
{}
|
Returns:
| Type | Description |
|---|---|
Thread
|
The threading.Thread object managing the background execution. |
Source code in toolboxv2/utils/toolbox.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | |
show_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
244 245 246 | |
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, request_as_kwarg=False, row=False, state=None, level=-1, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None, websocket_handler=None, websocket_context=False)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
-1
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
websocket_handler
|
str
|
The name of the websocket handler to use. |
None
|
websocket_context
|
bool
|
Flag to indicate if the function should receive the websocket context. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/toolbox.py
2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | |
wait_for_bg_tasks(timeout=None)
¶
Wait for all background tasks to complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Maximum time to wait (in seconds) for all tasks to complete. None means wait indefinitely. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if all tasks completed, False if timeout occurred |
Source code in toolboxv2/utils/toolbox.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | |
ws_broadcast(channel_id, payload, source_conn_id='python_broadcast')
async
¶
Sendet eine Nachricht asynchron an alle Clients in einem Kanal/Raum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
str
|
Der Kanal, an den gesendet werden soll. |
required |
payload
|
dict
|
Ein Dictionary, das als JSON gesendet wird. |
required |
source_conn_id
|
optional
|
Die ID der ursprünglichen Verbindung, um Echos zu vermeiden. |
'python_broadcast'
|
Source code in toolboxv2/utils/toolbox.py
2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | |
ws_send(conn_id, payload)
async
¶
Sendet eine Nachricht asynchron an eine einzelne WebSocket-Verbindung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn_id
|
str
|
Die eindeutige ID der Zielverbindung. |
required |
payload
|
dict
|
Ein Dictionary, das als JSON gesendet wird. |
required |
Source code in toolboxv2/utils/toolbox.py
2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 | |
workers
¶
ToolBoxV2 Worker System
High-performance Python workers for ToolBoxV2: - HTTP Worker: Raw WSGI, async request processing - WS Worker: Minimal overhead WebSocket handler - Event Manager: ZeroMQ-based IPC - Session: Signed cookies (stateless) - Manager: Nginx config, process orchestration, web UI
Usage
Start all workers¶
python -m tbv2_workers.cli_worker_manager start
Or import components¶
from tbv2_workers import HTTPWorker, WSWorker, SessionManager
Config
dataclass
¶
Main configuration container.
Source code in toolboxv2/utils/workers/config.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
from_dict(data)
classmethod
¶
Reconstruct config from dictionary.
Source code in toolboxv2/utils/workers/config.py
238 239 240 241 | |
to_dict()
¶
Convert config to dictionary for serialization.
Source code in toolboxv2/utils/workers/config.py
233 234 235 236 | |
ConnectionManager
¶
Manages WebSocket connections efficiently.
Uses weak references where possible to avoid memory leaks. Optimized for high connection counts.
Source code in toolboxv2/utils/workers/ws_worker.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
add(conn)
async
¶
Add a connection.
Source code in toolboxv2/utils/workers/ws_worker.py
125 126 127 128 129 130 131 132 133 | |
authenticate(conn_id, user_id, session_id)
async
¶
Mark connection as authenticated.
Source code in toolboxv2/utils/workers/ws_worker.py
159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get(conn_id)
¶
Get a connection by ID.
Source code in toolboxv2/utils/workers/ws_worker.py
155 156 157 | |
get_all_connections()
¶
Get all connections.
Source code in toolboxv2/utils/workers/ws_worker.py
206 207 208 | |
get_channel_connections(channel)
¶
Get all connections in a channel.
Source code in toolboxv2/utils/workers/ws_worker.py
196 197 198 199 | |
get_stats()
¶
Get connection statistics.
Source code in toolboxv2/utils/workers/ws_worker.py
210 211 212 213 214 215 216 217 218 219 220 | |
get_user_connections(user_id)
¶
Get all connections for a user.
Source code in toolboxv2/utils/workers/ws_worker.py
201 202 203 204 | |
join_channel(conn_id, channel)
async
¶
Add connection to channel.
Source code in toolboxv2/utils/workers/ws_worker.py
173 174 175 176 177 178 179 180 181 182 | |
leave_channel(conn_id, channel)
async
¶
Remove connection from channel.
Source code in toolboxv2/utils/workers/ws_worker.py
184 185 186 187 188 189 190 191 192 193 194 | |
remove(conn_id)
async
¶
Remove a connection.
Source code in toolboxv2/utils/workers/ws_worker.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
Event
dataclass
¶
Event payload for ZeroMQ messages.
Source code in toolboxv2/utils/workers/event_manager.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
from_bytes(data)
classmethod
¶
Deserialize event from bytes.
Source code in toolboxv2/utils/workers/event_manager.py
119 120 121 122 123 124 125 126 127 128 129 130 131 | |
is_expired()
¶
Check if event TTL has expired.
Source code in toolboxv2/utils/workers/event_manager.py
133 134 135 | |
to_bytes()
¶
Serialize event to bytes.
Source code in toolboxv2/utils/workers/event_manager.py
106 107 108 109 110 111 112 113 114 115 116 117 | |
to_dict()
¶
Convert to dictionary.
Source code in toolboxv2/utils/workers/event_manager.py
137 138 139 140 141 142 143 144 145 146 147 | |
EventType
¶
Event types for routing.
Source code in toolboxv2/utils/workers/event_manager.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
HTTPWorker
¶
HTTP Worker with raw WSGI application and auth endpoints.
Source code in toolboxv2/utils/workers/server_worker.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | |
run(host=None, port=None, do_run=True)
¶
Run the HTTP worker.
Source code in toolboxv2/utils/workers/server_worker.py
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | |
wsgi_app(environ, start_response)
¶
Raw WSGI application entry point.
Source code in toolboxv2/utils/workers/server_worker.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | |
ParsedRequest
dataclass
¶
Parsed HTTP request.
Source code in toolboxv2/utils/workers/server_worker.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
get_bearer_token()
¶
Extract Bearer token from Authorization header.
Source code in toolboxv2/utils/workers/server_worker.py
81 82 83 84 85 86 | |
get_clerk_user_id()
¶
Get Clerk user ID from body.
Source code in toolboxv2/utils/workers/server_worker.py
98 99 100 101 102 | |
get_session_token()
¶
Get session token from body or Authorization header.
Source code in toolboxv2/utils/workers/server_worker.py
88 89 90 91 92 93 94 95 96 | |
to_toolbox_request()
¶
Convert to ToolBoxV2 RequestData format.
Source code in toolboxv2/utils/workers/server_worker.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
SessionData
dataclass
¶
Session payload stored in signed cookie.
Source code in toolboxv2/utils/workers/session.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
is_authenticated
property
¶
Check if session represents an authenticated user.
is_dirty
property
¶
Check if session has unsaved changes.
is_expired
property
¶
Check if session has expired.
anonymous()
classmethod
¶
Alias for anonymous_session.
Source code in toolboxv2/utils/workers/session.py
191 192 193 194 | |
anonymous_session(session_id=None)
classmethod
¶
Create anonymous session.
Source code in toolboxv2/utils/workers/session.py
140 141 142 143 144 145 146 147 148 149 150 | |
authenticated_session(user_id, user_name, level=AccessLevel.LOGGED_IN, clerk_user_id='', spec='', max_age=604800, **extra)
classmethod
¶
Create authenticated session.
Source code in toolboxv2/utils/workers/session.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
from_dict(data)
classmethod
¶
Create from dictionary.
Source code in toolboxv2/utils/workers/session.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
invalidate()
¶
Invalidate this session.
Source code in toolboxv2/utils/workers/session.py
181 182 183 184 185 186 187 188 | |
mark_dirty()
¶
Mark session as modified (needs to be saved).
Source code in toolboxv2/utils/workers/session.py
98 99 100 | |
to_dict()
¶
Convert to dictionary for serialization.
Source code in toolboxv2/utils/workers/session.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
SessionManager
¶
Combined session manager supporting: - Signed cookies (stateless, multi-worker safe) - Clerk verification - Bearer token auth - API key auth
For multi-worker setup, all session state is in the signed cookie. No server-side storage needed.
Source code in toolboxv2/utils/workers/session.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | |
clear_pending_updates()
¶
Clear all pending session updates.
Source code in toolboxv2/utils/workers/session.py
951 952 953 | |
create_authenticated_session(user_id, user_name, level=AccessLevel.LOGGED_IN, clerk_user_id='', spec='', max_age=None, **extra)
¶
Create an authenticated session and return both session and cookie header.
Returns:
| Type | Description |
|---|---|
Tuple[SessionData, str]
|
Tuple of (session_data, set_cookie_header) |
Source code in toolboxv2/utils/workers/session.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
create_cookie_header_for_session(session, max_age=None)
¶
Create Set-Cookie header for a specific session.
Always generates header regardless of dirty state.
Source code in toolboxv2/utils/workers/session.py
895 896 897 898 899 900 901 902 903 904 905 906 907 | |
create_session(user_id='', user_name='anonymous', level=AccessLevel.NOT_LOGGED_IN, spec='', clerk_user_id='', client_ip='', token='', max_age=None, **extra)
¶
Create a new session and return the session ID.
The session data is stored in a signed cookie, not server-side.
Returns:
| Name | Type | Description |
|---|---|---|
session_id |
str
|
The unique session identifier |
Source code in toolboxv2/utils/workers/session.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
delete_session(session_id)
¶
Delete/invalidate a session.
In stateless mode, this marks the session for cookie clearing.
Source code in toolboxv2/utils/workers/session.py
842 843 844 845 846 847 848 849 850 851 | |
get_logout_cookie_header()
¶
Get Set-Cookie header that clears the session cookie.
Source code in toolboxv2/utils/workers/session.py
909 910 911 | |
get_session(session_id)
¶
Get session by ID.
In stateless mode, this returns from pending updates or creates anonymous. The actual session data comes from the cookie, not server storage.
Source code in toolboxv2/utils/workers/session.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
get_session_from_request(environ, headers=None)
async
¶
Extract and verify session from request.
Checks in order: 1. API Key header 2. Bearer token (Clerk) 3. Signed cookie 4. Returns anonymous session
Source code in toolboxv2/utils/workers/session.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
get_session_from_request_sync(environ, headers=None)
¶
Synchronous version of get_session_from_request.
Source code in toolboxv2/utils/workers/session.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | |
get_set_cookie_header(session)
¶
Get Set-Cookie header for a session if it needs updating.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Set-Cookie header string, or None if no update needed |
Source code in toolboxv2/utils/workers/session.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | |
invalidate_session(session=None)
¶
Invalidate session and return Set-Cookie header that clears cookie.
Returns:
| Type | Description |
|---|---|
str
|
Set-Cookie header value |
Source code in toolboxv2/utils/workers/session.py
853 854 855 856 857 858 859 860 861 862 863 864 | |
register_api_key(api_key, session)
¶
Register an API key with associated session data.
Source code in toolboxv2/utils/workers/session.py
917 918 919 | |
revoke_api_key(api_key)
¶
Revoke an API key.
Source code in toolboxv2/utils/workers/session.py
921 922 923 | |
set_session_data(session, user_id=None, user_name=None, level=None, clerk_user_id=None, validated=None, anonymous=None, **extra)
¶
Update session fields and mark as dirty.
Returns the updated session.
Source code in toolboxv2/utils/workers/session.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | |
update_session(session)
¶
Mark session for update.
In stateless mode, this queues the session for cookie update.
Source code in toolboxv2/utils/workers/session.py
789 790 791 792 793 794 795 796 797 | |
verify_session_token(token)
¶
Verify a session token (sync).
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[SessionData]]
|
Tuple of (is_valid, session_data) |
Source code in toolboxv2/utils/workers/session.py
929 930 931 932 933 934 935 936 937 938 | |
verify_session_token_async(token)
async
¶
Verify a session token (async).
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[SessionData]]
|
Tuple of (is_valid, session_data) |
Source code in toolboxv2/utils/workers/session.py
940 941 942 943 944 945 946 947 948 949 | |
SignedCookieSession
¶
Stateless session manager using signed cookies.
Cookie format: base64(json_payload).signature Signature: HMAC-SHA256(secret, payload)
Source code in toolboxv2/utils/workers/session.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
create_cookie_header(session, max_age=None)
¶
Create Set-Cookie header value.
Source code in toolboxv2/utils/workers/session.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
create_logout_cookie_header()
¶
Create Set-Cookie header that clears the session.
Source code in toolboxv2/utils/workers/session.py
326 327 328 329 330 331 332 333 334 335 336 337 | |
decode(cookie_value)
¶
Decode and verify signed cookie value.
Source code in toolboxv2/utils/workers/session.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
encode(session)
¶
Encode session data to signed cookie value.
Source code in toolboxv2/utils/workers/session.py
255 256 257 258 259 260 | |
get_from_cookie_header(cookie_header)
¶
Extract session from Cookie header.
Source code in toolboxv2/utils/workers/session.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
get_from_environ(environ)
¶
Extract session from WSGI environ.
Source code in toolboxv2/utils/workers/session.py
356 357 358 359 | |
WSWorker
¶
High-performance WebSocket worker.
Minimal processing - forwards messages via ZeroMQ. Designed for maximum concurrent connections.
Source code in toolboxv2/utils/workers/ws_worker.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
get_stats()
¶
Get worker statistics.
Source code in toolboxv2/utils/workers/ws_worker.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
run()
async
¶
Run the WebSocket worker (blocking).
This method can be called: - With asyncio.run() for standalone execution - Within an existing event loop as a coroutine
Source code in toolboxv2/utils/workers/ws_worker.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | |
run_sync()
¶
Run the WebSocket worker synchronously (creates new event loop).
Use this method when calling from a non-async context.
For async contexts, use await worker.run() instead.
Source code in toolboxv2/utils/workers/ws_worker.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
start()
async
¶
Start the WebSocket worker.
Source code in toolboxv2/utils/workers/ws_worker.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
stop()
async
¶
Stop the WebSocket worker.
Source code in toolboxv2/utils/workers/ws_worker.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
ZMQEventManager
¶
ZeroMQ-based event manager for inter-worker communication.
Supports: - PUB/SUB for broadcasts - REQ/REP for RPC calls - PUSH/PULL for task distribution
Source code in toolboxv2/utils/workers/event_manager.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
get_metrics()
¶
Get event manager metrics.
Source code in toolboxv2/utils/workers/event_manager.py
722 723 724 | |
on(event_types, filter_func=None, priority=0, once=False)
¶
Decorator to register event handlers.
Source code in toolboxv2/utils/workers/event_manager.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | |
publish(event)
async
¶
Publish an event to all subscribers.
Source code in toolboxv2/utils/workers/event_manager.py
619 620 621 622 623 624 625 626 | |
register_handler(event_types, callback, filter_func=None, priority=0, once=False)
¶
Register an event handler.
Source code in toolboxv2/utils/workers/event_manager.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
rpc_call(event, timeout=5.0)
async
¶
Make an RPC call and wait for response.
Source code in toolboxv2/utils/workers/event_manager.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
send_to_ws(event)
async
¶
Send event to WS workers via PUSH socket (HTTP workers only).
Source code in toolboxv2/utils/workers/event_manager.py
628 629 630 631 632 633 634 | |
send_to_ws_sync(event)
¶
Synchronous version of send_to_ws.
Source code in toolboxv2/utils/workers/event_manager.py
636 637 638 639 640 641 642 643 644 | |
start()
async
¶
Start the event manager.
Source code in toolboxv2/utils/workers/event_manager.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
stop()
async
¶
Stop the event manager.
Source code in toolboxv2/utils/workers/event_manager.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
subscribe(channel)
¶
Subscribe to a channel.
Source code in toolboxv2/utils/workers/event_manager.py
672 673 674 675 676 677 | |
unsubscribe(channel)
¶
Unsubscribe from a channel.
Source code in toolboxv2/utils/workers/event_manager.py
679 680 681 682 683 684 | |
cli_config()
¶
CLI for configuration management.
Source code in toolboxv2/utils/workers/config.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
cli_event()
async
¶
CLI entry point for broker.
Source code in toolboxv2/utils/workers/event_manager.py
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | |
cli_session()
¶
CLI for session management tools.
Source code in toolboxv2/utils/workers/session.py
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
get_default_config_yaml()
¶
Generate default configuration YAML with comments.
Source code in toolboxv2/utils/workers/config.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | |
load_config(config_path=None)
¶
Load configuration from YAML file with environment overrides.
Source code in toolboxv2/utils/workers/config.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
config
¶
config.py - Configuration Management for ToolBoxV2 Worker System
Handles YAML configuration with environment variable overrides. Supports: local development, production server, Tauri desktop app.
Enhanced with: - open_modules: List of publicly accessible modules (no auth required) - Level system configuration - WebSocket authentication options
AccessLevel
¶
User access levels for authorization.
Source code in toolboxv2/utils/workers/config.py
61 62 63 64 65 66 | |
AuthConfig
dataclass
¶
Authentication configuration.
Source code in toolboxv2/utils/workers/config.py
102 103 104 105 106 107 108 109 110 111 112 113 114 | |
Config
dataclass
¶
Main configuration container.
Source code in toolboxv2/utils/workers/config.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
from_dict(data)
classmethod
¶Reconstruct config from dictionary.
Source code in toolboxv2/utils/workers/config.py
238 239 240 241 | |
to_dict()
¶Convert config to dictionary for serialization.
Source code in toolboxv2/utils/workers/config.py
233 234 235 236 | |
Environment
¶
Detect runtime environment.
Source code in toolboxv2/utils/workers/config.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
get_mode()
staticmethod
¶Get current mode string.
Source code in toolboxv2/utils/workers/config.py
46 47 48 49 50 51 52 53 | |
is_development()
staticmethod
¶Check if development mode.
Source code in toolboxv2/utils/workers/config.py
41 42 43 44 | |
is_production()
staticmethod
¶Check if production mode.
Source code in toolboxv2/utils/workers/config.py
36 37 38 39 | |
is_tauri()
staticmethod
¶Check if running inside Tauri.
Source code in toolboxv2/utils/workers/config.py
30 31 32 33 34 | |
HTTPWorkerConfig
dataclass
¶
HTTP worker configuration.
Source code in toolboxv2/utils/workers/config.py
117 118 119 120 121 122 123 124 125 126 127 | |
ManagerConfig
dataclass
¶
Worker manager configuration.
Source code in toolboxv2/utils/workers/config.py
173 174 175 176 177 178 179 180 181 182 183 184 185 | |
NginxConfig
dataclass
¶
Nginx configuration.
Source code in toolboxv2/utils/workers/config.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
SessionConfig
dataclass
¶
Session/Cookie configuration.
Source code in toolboxv2/utils/workers/config.py
88 89 90 91 92 93 94 95 96 97 98 99 | |
ToolBoxV2Config
dataclass
¶
ToolBoxV2 integration configuration with access control.
Source code in toolboxv2/utils/workers/config.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
WSWorkerConfig
dataclass
¶
WebSocket worker configuration.
Source code in toolboxv2/utils/workers/config.py
130 131 132 133 134 135 136 137 138 139 140 | |
ZMQConfig
dataclass
¶
ZeroMQ configuration.
Source code in toolboxv2/utils/workers/config.py
74 75 76 77 78 79 80 81 82 83 84 85 | |
get_default_config_yaml()
¶
Generate default configuration YAML with comments.
Source code in toolboxv2/utils/workers/config.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | |
load_config(config_path=None)
¶
Load configuration from YAML file with environment overrides.
Source code in toolboxv2/utils/workers/config.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
main()
¶
CLI for configuration management.
Source code in toolboxv2/utils/workers/config.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
event_manager
¶
event_manager.py - ZeroMQ-based Event Manager for ToolBoxV2 Worker System
High-performance pub/sub and request/reply patterns for: - Inter-worker communication (HTTP -> WS) - Broadcast events (session invalidation, config reload) - Direct RPC calls between workers
Patterns: - PUB/SUB: One-to-many broadcasts - PUSH/PULL: Load-balanced task distribution - REQ/REP: Synchronous RPC calls
Event
dataclass
¶
Event payload for ZeroMQ messages.
Source code in toolboxv2/utils/workers/event_manager.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
from_bytes(data)
classmethod
¶Deserialize event from bytes.
Source code in toolboxv2/utils/workers/event_manager.py
119 120 121 122 123 124 125 126 127 128 129 130 131 | |
is_expired()
¶Check if event TTL has expired.
Source code in toolboxv2/utils/workers/event_manager.py
133 134 135 | |
to_bytes()
¶Serialize event to bytes.
Source code in toolboxv2/utils/workers/event_manager.py
106 107 108 109 110 111 112 113 114 115 116 117 | |
to_dict()
¶Convert to dictionary.
Source code in toolboxv2/utils/workers/event_manager.py
137 138 139 140 141 142 143 144 145 146 147 | |
EventHandler
dataclass
¶
Handler registration for events.
Source code in toolboxv2/utils/workers/event_manager.py
150 151 152 153 154 155 156 157 158 | |
EventHandlerRegistry
¶
Registry for event handlers.
Source code in toolboxv2/utils/workers/event_manager.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
clear()
¶Clear all handlers.
Source code in toolboxv2/utils/workers/event_manager.py
233 234 235 236 237 | |
get_handlers(event_type)
¶Get all handlers for an event type.
Source code in toolboxv2/utils/workers/event_manager.py
226 227 228 229 230 231 | |
register(event_types, callback, filter_func=None, priority=0, once=False)
¶Register an event handler.
Source code in toolboxv2/utils/workers/event_manager.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
register_global(callback, filter_func=None, priority=0)
¶Register a global handler for all events.
Source code in toolboxv2/utils/workers/event_manager.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
unregister(handler)
¶Unregister an event handler.
Source code in toolboxv2/utils/workers/event_manager.py
217 218 219 220 221 222 223 224 | |
EventType
¶
Event types for routing.
Source code in toolboxv2/utils/workers/event_manager.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
ZMQEventManager
¶
ZeroMQ-based event manager for inter-worker communication.
Supports: - PUB/SUB for broadcasts - REQ/REP for RPC calls - PUSH/PULL for task distribution
Source code in toolboxv2/utils/workers/event_manager.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
get_metrics()
¶Get event manager metrics.
Source code in toolboxv2/utils/workers/event_manager.py
722 723 724 | |
on(event_types, filter_func=None, priority=0, once=False)
¶Decorator to register event handlers.
Source code in toolboxv2/utils/workers/event_manager.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | |
publish(event)
async
¶Publish an event to all subscribers.
Source code in toolboxv2/utils/workers/event_manager.py
619 620 621 622 623 624 625 626 | |
register_handler(event_types, callback, filter_func=None, priority=0, once=False)
¶Register an event handler.
Source code in toolboxv2/utils/workers/event_manager.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
rpc_call(event, timeout=5.0)
async
¶Make an RPC call and wait for response.
Source code in toolboxv2/utils/workers/event_manager.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
send_to_ws(event)
async
¶Send event to WS workers via PUSH socket (HTTP workers only).
Source code in toolboxv2/utils/workers/event_manager.py
628 629 630 631 632 633 634 | |
send_to_ws_sync(event)
¶Synchronous version of send_to_ws.
Source code in toolboxv2/utils/workers/event_manager.py
636 637 638 639 640 641 642 643 644 | |
start()
async
¶Start the event manager.
Source code in toolboxv2/utils/workers/event_manager.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
stop()
async
¶Stop the event manager.
Source code in toolboxv2/utils/workers/event_manager.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
subscribe(channel)
¶Subscribe to a channel.
Source code in toolboxv2/utils/workers/event_manager.py
672 673 674 675 676 677 | |
unsubscribe(channel)
¶Unsubscribe from a channel.
Source code in toolboxv2/utils/workers/event_manager.py
679 680 681 682 683 684 | |
create_ws_broadcast_all_event(source, payload, exclude_conn_ids=None)
¶
Create WS_BROADCAST_ALL event.
Source code in toolboxv2/utils/workers/event_manager.py
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | |
create_ws_broadcast_event(source, channel, payload, exclude_conn_ids=None)
¶
Create WS_BROADCAST_CHANNEL event.
Source code in toolboxv2/utils/workers/event_manager.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | |
create_ws_send_event(source, conn_id, payload)
¶
Create WS_SEND event.
Source code in toolboxv2/utils/workers/event_manager.py
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | |
main()
async
¶
CLI entry point for broker.
Source code in toolboxv2/utils/workers/event_manager.py
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | |
run_broker(config)
async
¶
Run ZMQ broker as standalone process.
Source code in toolboxv2/utils/workers/event_manager.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
server_worker
¶
server_worker.py - High-Performance HTTP Worker for ToolBoxV2
Raw WSGI implementation without frameworks. Features: - Raw WSGI (no framework) - Async request processing - Signed cookie sessions - ZeroMQ event integration - ToolBoxV2 module routing - SSE streaming support - WebSocket message handling via ZMQ - Auth endpoints (validateSession, IsValidSession, logout, api_user_data) - Access Control (open_modules, open* functions, level system)
AccessController
¶
Controls access to API endpoints based on: - open_modules: Modules that are publicly accessible - Function names: Functions starting with 'open' are public - User level: -1=Admin, 0=not logged in, 1=logged in, 2=trusted
Source code in toolboxv2/utils/workers/server_worker.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
check_access(module_name, function_name, user_level, required_level=AccessLevel.LOGGED_IN)
¶Check if user has access to endpoint.
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[str]]
|
Tuple of (allowed: bool, error_message: Optional[str]) |
Source code in toolboxv2/utils/workers/server_worker.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
get_user_level(session)
¶Extract user level from session.
Source code in toolboxv2/utils/workers/server_worker.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
is_public_endpoint(module_name, function_name)
¶Check if endpoint is publicly accessible (no auth required).
Source code in toolboxv2/utils/workers/server_worker.py
283 284 285 286 287 288 289 290 291 292 293 | |
AccessLevel
¶
User access levels.
Source code in toolboxv2/utils/workers/server_worker.py
48 49 50 51 52 53 | |
AuthHandler
¶
Handles authentication endpoints equivalent to Rust handlers: - /validateSession (POST) - /IsValidSession (GET) - /web/logoutS (POST) - /api_user_data (GET)
Source code in toolboxv2/utils/workers/server_worker.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
get_user_data(request)
async
¶Get user data from Clerk. Equivalent to get_user_data_handler in Rust.
Source code in toolboxv2/utils/workers/server_worker.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
is_valid_session(request)
async
¶Check if current session is valid. Equivalent to is_valid_session_handler in Rust.
Source code in toolboxv2/utils/workers/server_worker.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
logout(request)
async
¶Logout user and invalidate session. Equivalent to logout_handler in Rust.
Source code in toolboxv2/utils/workers/server_worker.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
validate_session(request)
async
¶Validate session with Clerk token. Equivalent to validate_session_handler in Rust.
Source code in toolboxv2/utils/workers/server_worker.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
HTTPWorker
¶
HTTP Worker with raw WSGI application and auth endpoints.
Source code in toolboxv2/utils/workers/server_worker.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | |
run(host=None, port=None, do_run=True)
¶Run the HTTP worker.
Source code in toolboxv2/utils/workers/server_worker.py
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | |
wsgi_app(environ, start_response)
¶Raw WSGI application entry point.
Source code in toolboxv2/utils/workers/server_worker.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | |
ParsedRequest
dataclass
¶
Parsed HTTP request.
Source code in toolboxv2/utils/workers/server_worker.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
get_bearer_token()
¶Extract Bearer token from Authorization header.
Source code in toolboxv2/utils/workers/server_worker.py
81 82 83 84 85 86 | |
get_clerk_user_id()
¶Get Clerk user ID from body.
Source code in toolboxv2/utils/workers/server_worker.py
98 99 100 101 102 | |
get_session_token()
¶Get session token from body or Authorization header.
Source code in toolboxv2/utils/workers/server_worker.py
88 89 90 91 92 93 94 95 96 | |
to_toolbox_request()
¶Convert to ToolBoxV2 RequestData format.
Source code in toolboxv2/utils/workers/server_worker.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
ToolBoxHandler
¶
Handler for ToolBoxV2 module calls with access control.
Source code in toolboxv2/utils/workers/server_worker.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
handle_api_call(request)
async
¶Handle API call to ToolBoxV2 module with access control.
Source code in toolboxv2/utils/workers/server_worker.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | |
parse_api_path(path)
¶Parse /api/Module/function into (module, function).
Source code in toolboxv2/utils/workers/server_worker.py
625 626 627 628 629 630 631 632 633 | |
WebSocketMessageHandler
¶
Handles WebSocket messages forwarded from WS workers via ZMQ. Routes messages to registered websocket_handler functions in ToolBoxV2.
Source code in toolboxv2/utils/workers/server_worker.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | |
handle_ws_connect(event)
async
¶Handle WebSocket connect event.
Source code in toolboxv2/utils/workers/server_worker.py
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | |
handle_ws_disconnect(event)
async
¶Handle WebSocket disconnect event.
Source code in toolboxv2/utils/workers/server_worker.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 | |
handle_ws_message(event)
async
¶Handle WebSocket message event with access control.
Source code in toolboxv2/utils/workers/server_worker.py
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
api_result_response(error=None, origin=None, data=None, data_info=None, data_type=None, exec_code=0, help_text='OK', status=200)
¶
Create a ToolBoxV2-style API result response.
Source code in toolboxv2/utils/workers/server_worker.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
parse_request(environ)
¶
Parse WSGI environ into structured request.
Source code in toolboxv2/utils/workers/server_worker.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
session
¶
session.py - Stateless Session Management with Signed Cookies
Implements signed cookies for horizontal scaling without shared storage. Session data is encoded in the cookie itself, signed with HMAC-SHA256.
Features: - Stateless: No server-side session storage needed - Secure: HMAC-SHA256 signature prevents tampering - Expiry: Built-in TTL support - Clerk integration: Verify sessions via CloudM.AuthClerk - Multi-worker support: All session state in signed cookie
AccessLevel
¶
User access levels for authorization.
Source code in toolboxv2/utils/workers/session.py
37 38 39 40 41 42 | |
ClerkSessionVerifier
¶
Verify sessions using CloudM.AuthClerk from ToolBoxV2.
Falls back to signed cookie if Clerk is not available.
Source code in toolboxv2/utils/workers/session.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
verify_session_async(session_token)
async
¶Verify session token via Clerk.
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[SessionData]]
|
Tuple of (is_valid, session_data) |
Source code in toolboxv2/utils/workers/session.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
verify_session_sync(session_token)
¶Synchronous version of verify_session.
Source code in toolboxv2/utils/workers/session.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
SessionData
dataclass
¶
Session payload stored in signed cookie.
Source code in toolboxv2/utils/workers/session.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
is_authenticated
property
¶Check if session represents an authenticated user.
is_dirty
property
¶Check if session has unsaved changes.
is_expired
property
¶Check if session has expired.
anonymous()
classmethod
¶Alias for anonymous_session.
Source code in toolboxv2/utils/workers/session.py
191 192 193 194 | |
anonymous_session(session_id=None)
classmethod
¶Create anonymous session.
Source code in toolboxv2/utils/workers/session.py
140 141 142 143 144 145 146 147 148 149 150 | |
authenticated_session(user_id, user_name, level=AccessLevel.LOGGED_IN, clerk_user_id='', spec='', max_age=604800, **extra)
classmethod
¶Create authenticated session.
Source code in toolboxv2/utils/workers/session.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
from_dict(data)
classmethod
¶Create from dictionary.
Source code in toolboxv2/utils/workers/session.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
invalidate()
¶Invalidate this session.
Source code in toolboxv2/utils/workers/session.py
181 182 183 184 185 186 187 188 | |
mark_dirty()
¶Mark session as modified (needs to be saved).
Source code in toolboxv2/utils/workers/session.py
98 99 100 | |
to_dict()
¶Convert to dictionary for serialization.
Source code in toolboxv2/utils/workers/session.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
SessionManager
¶
Combined session manager supporting: - Signed cookies (stateless, multi-worker safe) - Clerk verification - Bearer token auth - API key auth
For multi-worker setup, all session state is in the signed cookie. No server-side storage needed.
Source code in toolboxv2/utils/workers/session.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | |
clear_pending_updates()
¶Clear all pending session updates.
Source code in toolboxv2/utils/workers/session.py
951 952 953 | |
create_authenticated_session(user_id, user_name, level=AccessLevel.LOGGED_IN, clerk_user_id='', spec='', max_age=None, **extra)
¶Create an authenticated session and return both session and cookie header.
Returns:
| Type | Description |
|---|---|
Tuple[SessionData, str]
|
Tuple of (session_data, set_cookie_header) |
Source code in toolboxv2/utils/workers/session.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
create_cookie_header_for_session(session, max_age=None)
¶Create Set-Cookie header for a specific session.
Always generates header regardless of dirty state.
Source code in toolboxv2/utils/workers/session.py
895 896 897 898 899 900 901 902 903 904 905 906 907 | |
create_session(user_id='', user_name='anonymous', level=AccessLevel.NOT_LOGGED_IN, spec='', clerk_user_id='', client_ip='', token='', max_age=None, **extra)
¶Create a new session and return the session ID.
The session data is stored in a signed cookie, not server-side.
Returns:
| Name | Type | Description |
|---|---|---|
session_id |
str
|
The unique session identifier |
Source code in toolboxv2/utils/workers/session.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
delete_session(session_id)
¶Delete/invalidate a session.
In stateless mode, this marks the session for cookie clearing.
Source code in toolboxv2/utils/workers/session.py
842 843 844 845 846 847 848 849 850 851 | |
get_logout_cookie_header()
¶Get Set-Cookie header that clears the session cookie.
Source code in toolboxv2/utils/workers/session.py
909 910 911 | |
get_session(session_id)
¶Get session by ID.
In stateless mode, this returns from pending updates or creates anonymous. The actual session data comes from the cookie, not server storage.
Source code in toolboxv2/utils/workers/session.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
get_session_from_request(environ, headers=None)
async
¶Extract and verify session from request.
Checks in order: 1. API Key header 2. Bearer token (Clerk) 3. Signed cookie 4. Returns anonymous session
Source code in toolboxv2/utils/workers/session.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
get_session_from_request_sync(environ, headers=None)
¶Synchronous version of get_session_from_request.
Source code in toolboxv2/utils/workers/session.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | |
get_set_cookie_header(session)
¶Get Set-Cookie header for a session if it needs updating.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Set-Cookie header string, or None if no update needed |
Source code in toolboxv2/utils/workers/session.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | |
invalidate_session(session=None)
¶Invalidate session and return Set-Cookie header that clears cookie.
Returns:
| Type | Description |
|---|---|
str
|
Set-Cookie header value |
Source code in toolboxv2/utils/workers/session.py
853 854 855 856 857 858 859 860 861 862 863 864 | |
register_api_key(api_key, session)
¶Register an API key with associated session data.
Source code in toolboxv2/utils/workers/session.py
917 918 919 | |
revoke_api_key(api_key)
¶Revoke an API key.
Source code in toolboxv2/utils/workers/session.py
921 922 923 | |
set_session_data(session, user_id=None, user_name=None, level=None, clerk_user_id=None, validated=None, anonymous=None, **extra)
¶Update session fields and mark as dirty.
Returns the updated session.
Source code in toolboxv2/utils/workers/session.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | |
update_session(session)
¶Mark session for update.
In stateless mode, this queues the session for cookie update.
Source code in toolboxv2/utils/workers/session.py
789 790 791 792 793 794 795 796 797 | |
verify_session_token(token)
¶Verify a session token (sync).
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[SessionData]]
|
Tuple of (is_valid, session_data) |
Source code in toolboxv2/utils/workers/session.py
929 930 931 932 933 934 935 936 937 938 | |
verify_session_token_async(token)
async
¶Verify a session token (async).
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[SessionData]]
|
Tuple of (is_valid, session_data) |
Source code in toolboxv2/utils/workers/session.py
940 941 942 943 944 945 946 947 948 949 | |
SessionMiddleware
¶
WSGI middleware that adds session to environ and handles cookie updates.
Source code in toolboxv2/utils/workers/session.py
961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | |
__call__(environ, start_response)
¶Process request and add session to environ.
Source code in toolboxv2/utils/workers/session.py
974 975 976 977 978 979 980 981 982 983 984 985 986 | |
SignedCookieSession
¶
Stateless session manager using signed cookies.
Cookie format: base64(json_payload).signature Signature: HMAC-SHA256(secret, payload)
Source code in toolboxv2/utils/workers/session.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
create_cookie_header(session, max_age=None)
¶Create Set-Cookie header value.
Source code in toolboxv2/utils/workers/session.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
create_logout_cookie_header()
¶Create Set-Cookie header that clears the session.
Source code in toolboxv2/utils/workers/session.py
326 327 328 329 330 331 332 333 334 335 336 337 | |
decode(cookie_value)
¶Decode and verify signed cookie value.
Source code in toolboxv2/utils/workers/session.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
encode(session)
¶Encode session data to signed cookie value.
Source code in toolboxv2/utils/workers/session.py
255 256 257 258 259 260 | |
get_from_cookie_header(cookie_header)
¶Extract session from Cookie header.
Source code in toolboxv2/utils/workers/session.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
get_from_environ(environ)
¶Extract session from WSGI environ.
Source code in toolboxv2/utils/workers/session.py
356 357 358 359 | |
generate_secret(length=64)
¶
Generate a secure random secret.
Source code in toolboxv2/utils/workers/session.py
994 995 996 | |
main()
¶
CLI for session management tools.
Source code in toolboxv2/utils/workers/session.py
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
require_auth(min_level=AccessLevel.LOGGED_IN)
¶
Decorator to require authentication for handlers.
Source code in toolboxv2/utils/workers/session.py
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | |
require_level(level)
¶
Decorator to require specific access level.
Source code in toolboxv2/utils/workers/session.py
1023 1024 1025 | |
tauri_integration
¶
tauri_integration.py - Tauri Desktop App Integration
Provides seamless integration for running the worker system inside a Tauri application.
Features: - Single-process mode for desktop - Embedded HTTP/WS servers (unified management) - IPC via Tauri commands - Auto-configuration for local use - WS worker bundled with HTTP worker for production
Architecture: - HTTP Worker: Handles all API requests, auth, ToolBox module calls - WS Worker: Handles WebSocket connections for real-time features - Both share the same ToolBox app instance and communicate via ZMQ
TauriWorkerManager
¶
Unified worker manager for Tauri desktop apps.
Manages both HTTP and WS workers in a single process, optimized for single-user local operation.
The HTTP worker does the "underlying work" (ToolBox calls, auth, etc.) while the WS worker provides real-time WebSocket connections. Both are bundled together for production builds.
Source code in toolboxv2/utils/workers/tauri_integration.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
get_http_url()
¶Get HTTP server URL.
Source code in toolboxv2/utils/workers/tauri_integration.py
197 198 199 200 | |
get_ws_url()
¶Get WebSocket server URL.
Source code in toolboxv2/utils/workers/tauri_integration.py
202 203 204 205 206 207 | |
is_ws_enabled()
¶Check if WS worker is enabled.
Source code in toolboxv2/utils/workers/tauri_integration.py
209 210 211 | |
start()
¶Start workers in background thread.
Source code in toolboxv2/utils/workers/tauri_integration.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
stop()
¶Stop all workers gracefully.
Source code in toolboxv2/utils/workers/tauri_integration.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
get_manager()
¶
Get or create the global manager.
Source code in toolboxv2/utils/workers/tauri_integration.py
222 223 224 225 226 227 | |
main()
¶
Run Tauri worker manager standalone.
This is the entry point for the bundled sidecar binary. It starts both HTTP and WS workers in a unified process.
Source code in toolboxv2/utils/workers/tauri_integration.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
tauri_call_module(module, function, args=None)
¶
Call ToolBoxV2 module function (Tauri command).
Direct IPC without HTTP for better performance.
Source code in toolboxv2/utils/workers/tauri_integration.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
tauri_get_status()
¶
Get worker status (Tauri command).
Source code in toolboxv2/utils/workers/tauri_integration.py
254 255 256 257 258 259 260 261 262 | |
tauri_start_workers()
¶
Start workers (Tauri command).
Source code in toolboxv2/utils/workers/tauri_integration.py
230 231 232 233 234 235 236 237 238 239 240 241 | |
tauri_stop_workers()
¶
Stop workers (Tauri command).
Source code in toolboxv2/utils/workers/tauri_integration.py
244 245 246 247 248 249 250 251 | |
toolbox_integration
¶
toolbox_integration.py - ToolBoxV2 Integration Layer
Integration between the worker system and ToolBoxV2: - server_helper() integration - Module function routing with access control - Session verification via CloudM.AuthClerk - Event manager bridge - Level-based authorization
AccessController
¶
Controls access to API endpoints based on: - open_modules: Modules that are publicly accessible - admin_modules: Modules requiring admin level (-1) - Function names: Functions starting with 'open' are public - User level: -1=Admin, 0=not logged in, 1=logged in, 2=trusted - level_requirements: Per-module/function level overrides
Source code in toolboxv2/utils/workers/toolbox_integration.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
check_access(module_name, function_name, user_level)
¶Check if user has access to endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
str
|
The module being accessed |
required |
function_name
|
str
|
The function being called |
required |
user_level
|
int
|
The user's access level |
required |
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[str]]
|
Tuple of (allowed: bool, error_message: Optional[str]) |
Source code in toolboxv2/utils/workers/toolbox_integration.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
get_required_level(module_name, function_name)
¶Get the required access level for an endpoint.
Source code in toolboxv2/utils/workers/toolbox_integration.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
get_user_level(session)
staticmethod
¶Extract user level from session object.
Source code in toolboxv2/utils/workers/toolbox_integration.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
is_admin_only(module_name, function_name=None)
¶Check if endpoint requires admin level.
Source code in toolboxv2/utils/workers/toolbox_integration.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
is_public_endpoint(module_name, function_name)
¶Check if endpoint is publicly accessible (no auth required).
Source code in toolboxv2/utils/workers/toolbox_integration.py
161 162 163 164 165 166 167 168 169 170 171 | |
reload_config(config=None)
¶Reload configuration.
Source code in toolboxv2/utils/workers/toolbox_integration.py
155 156 157 158 159 | |
AccessLevel
¶
User access levels for authorization.
Source code in toolboxv2/utils/workers/toolbox_integration.py
25 26 27 28 29 30 | |
ModuleRouter
¶
Routes API requests to ToolBoxV2 module functions with access control.
Source code in toolboxv2/utils/workers/toolbox_integration.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
call_function(module_name, function_name, request_data, session=None, check_access=True, **kwargs)
async
¶Call a ToolBoxV2 module function with optional access check.
Source code in toolboxv2/utils/workers/toolbox_integration.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
call_function_sync(module_name, function_name, request_data, session=None, check_access=True, **kwargs)
¶Sync version of call_function.
Source code in toolboxv2/utils/workers/toolbox_integration.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
check_access(module_name, function_name, session)
¶Check access for a request.
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[str], int]
|
Tuple of (allowed, error_message, user_level) |
Source code in toolboxv2/utils/workers/toolbox_integration.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
parse_path(path)
¶Parse /api/Module/function into (module, function).
Source code in toolboxv2/utils/workers/toolbox_integration.py
304 305 306 307 308 309 310 311 312 313 314 | |
ZMQEventBridge
¶
Bridge between ToolBoxV2 EventManager and ZeroMQ.
Source code in toolboxv2/utils/workers/toolbox_integration.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | |
connect()
¶Connect to ToolBoxV2 EventManager if available.
Source code in toolboxv2/utils/workers/toolbox_integration.py
491 492 493 494 495 496 497 498 499 500 501 | |
create_access_controller(config)
¶
Create an AccessController from config.
Source code in toolboxv2/utils/workers/toolbox_integration.py
549 550 551 | |
create_worker_app(instance_id, config)
¶
Create ToolBoxV2 app, router, and access controller for a worker.
Returns:
| Type | Description |
|---|---|
Tuple[Any, ModuleRouter, AccessController]
|
Tuple of (app, router, access_controller) |
Source code in toolboxv2/utils/workers/toolbox_integration.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
get_toolbox_app(instance_id='worker', **kwargs)
¶
Get ToolBoxV2 App instance using server_helper.
Source code in toolboxv2/utils/workers/toolbox_integration.py
38 39 40 41 42 43 44 45 | |
verify_session_via_clerk(app, session_token, auth_module='CloudM.AuthClerk', verify_func='verify_session')
¶
Verify session using CloudM.AuthClerk.
Source code in toolboxv2/utils/workers/toolbox_integration.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
verify_session_via_clerk_async(app, session_token, auth_module='CloudM.AuthClerk', verify_func='verify_session')
async
¶
Async version of verify_session_via_clerk.
Source code in toolboxv2/utils/workers/toolbox_integration.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
ws_bridge
¶
ws_bridge.py - WebSocket Bridge for ToolBoxV2 HTTP Workers¶
Provides WebSocket communication methods for App instances that communicate with WS workers via ZeroMQ.
Features
- ws_send(): Send message to specific WebSocket connection
- ws_broadcast(): Broadcast to all connections in a channel
- ws_broadcast_all(): Broadcast to ALL connected clients
- send_notification(): Send Tauri native notifications to clients
Usage Example
from toolboxv2.utils.workers.ws_bridge import install_ws_bridge
Install bridge on app instance¶
bridge = install_ws_bridge(app, event_manager, "my_worker")
Send message to specific connection¶
await app.ws_send("conn-123", {"type": "update", "data": {...}})
Broadcast to channel¶
await app.ws_broadcast("general", {"type": "message", "text": "Hello"})
Broadcast to all¶
await app.ws_broadcast_all({"type": "announcement", "text": "..."})
Notification System
For sending notifications to Tauri/Web clients, use the NotificationSystem from toolboxv2.utils.extras.notification:
from toolboxv2.utils.extras.notification import setup_web_notifications
notifier = setup_web_notifications(bridge)
notifier.notify_web("Title", "Message")
See: toolboxv2/utils/extras/notification.py
Frontend Integration
The DesktopStatusBar component in tbjs maintains a persistent WebSocket connection and listens for notification messages. When received, it triggers Tauri's native notification API via tauriAPI.notify().
See: toolboxv2/tbjs/src/ui/components/Desktop/index.js
ZMQWSBridge
¶
WebSocket bridge that communicates with WS workers via ZeroMQ.
Provides the same interface as the old Rust bridge: - ws_send(conn_id, payload) - ws_broadcast(channel_id, payload, source_conn_id)
Usage
bridge = ZMQWSBridge(event_manager, worker_id) app._zmq_ws_bridge = bridge # Set on app instance
Then in app methods:¶
await app.ws_send(conn_id, {"type": "message", "data": "hello"})
Source code in toolboxv2/utils/workers/ws_bridge.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
broadcast_all(payload, exclude_conn_ids=None)
async
¶Broadcast message to all connected WebSocket clients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
str | dict
|
JSON string or dict to send |
required |
exclude_conn_ids
|
List[str] | None
|
Optional list of connection IDs to exclude |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if broadcast was sent |
Source code in toolboxv2/utils/workers/ws_bridge.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
broadcast_message(channel_id, payload, source_conn_id='')
async
¶Broadcast message to all connections in a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
str
|
Target channel/room ID |
required |
payload
|
str | dict
|
JSON string or dict to send |
required |
source_conn_id
|
str
|
Optional - exclude this connection from broadcast |
''
|
Returns:
| Type | Description |
|---|---|
bool
|
True if broadcast was sent (doesn't guarantee delivery) |
Source code in toolboxv2/utils/workers/ws_bridge.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
join_channel(conn_id, channel)
async
¶Request a connection to join a channel.
Source code in toolboxv2/utils/workers/ws_bridge.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
leave_channel(conn_id, channel)
async
¶Request a connection to leave a channel.
Source code in toolboxv2/utils/workers/ws_bridge.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
send_message(conn_id, payload)
async
¶Send message to a specific WebSocket connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn_id
|
str
|
Target connection ID |
required |
payload
|
str | dict
|
JSON string or dict to send |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if message was sent (doesn't guarantee delivery) |
Source code in toolboxv2/utils/workers/ws_bridge.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
send_notification(title, content, conn_id=None, channel=None, icon=None, level='info')
async
¶Send a notification to WebSocket clients that triggers Tauri native notifications.
This method sends a specially formatted message that the frontend DesktopStatusBar component recognizes and displays as a native Tauri notification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Notification title (required) |
required |
content
|
str
|
Notification body/message (required) |
required |
conn_id
|
str | None
|
Send to specific connection only (optional) |
None
|
channel
|
str | None
|
Broadcast to all connections in channel (optional) |
None
|
icon
|
str | None
|
Notification icon path (optional) |
None
|
level
|
str
|
Notification level - "info", "warning", "error", "success" (default: "info") |
'info'
|
Returns:
| Type | Description |
|---|---|
bool
|
True if notification was sent successfully |
Note
- If conn_id is provided, sends to that specific connection
- If channel is provided, broadcasts to all connections in that channel
- If neither is provided, broadcasts to ALL connected clients
Example
Send to specific user¶
await bridge.send_notification( title="Task Complete", content="Your export is ready for download", conn_id="user-123" )
Broadcast to all users¶
await bridge.send_notification( title="System Update", content="Server will restart in 5 minutes", level="warning" )
Source code in toolboxv2/utils/workers/ws_bridge.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
install_ws_bridge(app, event_manager, worker_id)
¶
Install WebSocket bridge methods on a ToolBoxV2 App instance.
This replaces the old _set_rust_ws_bridge pattern with ZMQ-based communication.
After calling this function, app.ws_send() and app.ws_broadcast() will work.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
ToolBoxV2 App instance |
required | |
event_manager
|
ZMQEventManager
|
Initialized ZMQEventManager |
required |
worker_id
|
str
|
ID of this worker |
required |
Source code in toolboxv2/utils/workers/ws_bridge.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
ws_worker
¶
ws_worker.py - High-Performance WebSocket Worker for ToolBoxV2
Designed for maximum connections with minimal processing. All business logic delegated to HTTP workers via ZeroMQ.
Features: - Minimal processing overhead - ZeroMQ integration for message forwarding - Channel/room subscriptions - Connection state management - Heartbeat/ping-pong - Direct PULL socket for HTTP->WS messages (bypass broker for lower latency)
ConnectionManager
¶
Manages WebSocket connections efficiently.
Uses weak references where possible to avoid memory leaks. Optimized for high connection counts.
Source code in toolboxv2/utils/workers/ws_worker.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
add(conn)
async
¶Add a connection.
Source code in toolboxv2/utils/workers/ws_worker.py
125 126 127 128 129 130 131 132 133 | |
authenticate(conn_id, user_id, session_id)
async
¶Mark connection as authenticated.
Source code in toolboxv2/utils/workers/ws_worker.py
159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get(conn_id)
¶Get a connection by ID.
Source code in toolboxv2/utils/workers/ws_worker.py
155 156 157 | |
get_all_connections()
¶Get all connections.
Source code in toolboxv2/utils/workers/ws_worker.py
206 207 208 | |
get_channel_connections(channel)
¶Get all connections in a channel.
Source code in toolboxv2/utils/workers/ws_worker.py
196 197 198 199 | |
get_stats()
¶Get connection statistics.
Source code in toolboxv2/utils/workers/ws_worker.py
210 211 212 213 214 215 216 217 218 219 220 | |
get_user_connections(user_id)
¶Get all connections for a user.
Source code in toolboxv2/utils/workers/ws_worker.py
201 202 203 204 | |
join_channel(conn_id, channel)
async
¶Add connection to channel.
Source code in toolboxv2/utils/workers/ws_worker.py
173 174 175 176 177 178 179 180 181 182 | |
leave_channel(conn_id, channel)
async
¶Remove connection from channel.
Source code in toolboxv2/utils/workers/ws_worker.py
184 185 186 187 188 189 190 191 192 193 194 | |
remove(conn_id)
async
¶Remove a connection.
Source code in toolboxv2/utils/workers/ws_worker.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
WSConnection
dataclass
¶
WebSocket connection state.
Source code in toolboxv2/utils/workers/ws_worker.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
is_alive
property
¶Check if connection is still open.
WSWorker
¶
High-performance WebSocket worker.
Minimal processing - forwards messages via ZeroMQ. Designed for maximum concurrent connections.
Source code in toolboxv2/utils/workers/ws_worker.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
get_stats()
¶Get worker statistics.
Source code in toolboxv2/utils/workers/ws_worker.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
run()
async
¶Run the WebSocket worker (blocking).
This method can be called: - With asyncio.run() for standalone execution - Within an existing event loop as a coroutine
Source code in toolboxv2/utils/workers/ws_worker.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | |
run_sync()
¶Run the WebSocket worker synchronously (creates new event loop).
Use this method when calling from a non-async context.
For async contexts, use await worker.run() instead.
Source code in toolboxv2/utils/workers/ws_worker.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
start()
async
¶Start the WebSocket worker.
Source code in toolboxv2/utils/workers/ws_worker.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
stop()
async
¶Stop the WebSocket worker.
Source code in toolboxv2/utils/workers/ws_worker.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
toolboxv2.show_console(show=True)
¶
Source code in toolboxv2/utils/extras/show_and_hide_console.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Logging¶
toolboxv2.get_logger()
¶
Source code in toolboxv2/utils/system/tb_logger.py
137 138 | |
toolboxv2.setup_logging(level, name=loggerNameOfToolboxv2, online_level=None, is_online=False, file_level=None, interminal=False, logs_directory='../logs', app_name='main')
¶
Source code in toolboxv2/utils/system/tb_logger.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
Styling & Console Output¶
toolboxv2.Style
¶
Source code in toolboxv2/utils/extras/Style.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
toolboxv2.Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
__enter__()
¶
Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
652 653 654 655 656 657 | |
__exit__(exc_type, exc_value, exc_traceback)
¶
Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
659 660 661 662 663 664 665 666 | |
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶
Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
toolboxv2.remove_styles(text, infos=False)
¶
Source code in toolboxv2/utils/extras/Style.py
392 393 394 395 396 397 398 399 400 401 402 403 | |
Data Types & Structures¶
toolboxv2.AppArgs
¶
Source code in toolboxv2/utils/system/types.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |
toolboxv2.Result
¶
Bases: Generic[T]
Source code in toolboxv2/utils/system/types.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__class_getitem__(item)
¶
Enable Result[Type] syntax
Source code in toolboxv2/utils/system/types.py
734 735 736 737 738 739 740 741 742 743 744 | |
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | |
cast_to(target_type)
¶
Cast result to different type
Source code in toolboxv2/utils/system/types.py
829 830 831 832 833 834 835 836 837 838 839 | |
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
| Type | Description |
|---|---|
|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | |
get_type_info()
¶
Get the generic type information
Source code in toolboxv2/utils/system/types.py
841 842 843 | |
is_typed()
¶
Check if result has type information
Source code in toolboxv2/utils/system/types.py
845 846 847 | |
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | |
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
| Type | Description |
|---|---|
|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
dict | None
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Callable[[], None] | Callable[[], T] | Callable[[], AsyncGenerator[T, None]] | None
|
Optional function for cleanup. |
None
|
Returns:
| Type | Description |
|---|---|
|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
typed_aget(key=None, default=None)
async
¶
Async get data with type validation
Source code in toolboxv2/utils/system/types.py
758 759 760 761 762 763 764 765 766 767 | |
typed_get(key=None, default=None)
¶
Get data with type validation
Source code in toolboxv2/utils/system/types.py
746 747 748 749 750 751 752 753 754 755 756 | |
typed_json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create JSON result with type information
Source code in toolboxv2/utils/system/types.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
typed_ok(data, data_info='', info='OK', interface=ToolBoxInterfaces.native)
classmethod
¶
Create OK result with type information
Source code in toolboxv2/utils/system/types.py
796 797 798 799 800 801 802 803 804 805 806 807 | |
toolboxv2.ApiResult
¶
Bases: BaseModel
Source code in toolboxv2/utils/system/types.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | |
toolboxv2.RequestData
¶
Main class representing the complete request data structure.
Source code in toolboxv2/utils/system/types.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
__getattr__(name)
¶
Delegate unknown attributes to the request object.
Source code in toolboxv2/utils/system/types.py
413 414 415 416 417 418 419 | |
from_dict(data)
classmethod
¶
Create a RequestData instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
396 397 398 399 400 401 402 403 | |
to_dict()
¶
Convert the RequestData object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
405 406 407 408 409 410 411 | |
Security¶
toolboxv2.Code
¶
Source code in toolboxv2/utils/security/cryp.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
generate_random_string(length)
staticmethod
¶
Generiert eine zufällige Zeichenkette der angegebenen Länge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
Die Länge der zu generierenden Zeichenkette. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Die generierte Zeichenkette. |
Source code in toolboxv2/utils/security/cryp.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
114 115 116 117 118 119 120 121 122 | |
generate_symmetric_key(as_str=True)
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str or bytes
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
140 141 142 143 144 145 146 147 148 149 150 151 | |
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
| Type | Description |
|---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
433 434 435 436 437 438 439 440 441 442 443 444 445 | |
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
Modules & Flows¶
toolboxv2.mods
¶
Canvas
¶
Tools
¶
Bases: MainTool
Source code in toolboxv2/mods/Canvas.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
handle_send_canvas_action(app, request, data)
async
¶
Handles incremental, real-time actions from clients (e.g., adding an element). It persists the change to the database and then broadcasts it to all live listeners.
Source code in toolboxv2/mods/Canvas.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
markdown_to_svg(self, request, markdown_text='', width=400, font_family='sans-serif', font_size=14, bg_color='#ffffff', text_color='#000000')
async
¶
Converts a string of Markdown text into an SVG image. The SVG is returned as a base64 encoded data URL. This version uses a viewBox for better scalability and multi-line handling.
Source code in toolboxv2/mods/Canvas.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
save_session(app, request, data)
async
¶
Saves the entire state of a canvas session to the database. This is typically triggered by a user's explicit "Save" action.
Source code in toolboxv2/mods/Canvas.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
ChatModule
¶
get_chat_ui(app)
¶
Liefert das Haupt-HTML-UI für das Chat-Widget.
Es verwendet app.web_context(), um das notwendige tbjs CSS und JS einzubinden.
Source code in toolboxv2/mods/ChatModule.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
on_chat_message(app, conn_id, session, payload)
async
¶
Wird aufgerufen, wenn eine Nachricht von einem Client empfangen wird.
Source code in toolboxv2/mods/ChatModule.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
on_user_connect(app, conn_id, session)
async
¶
Wird vom Rust WebSocket Actor aufgerufen, wenn ein neuer Client eine Verbindung herstellt.
Source code in toolboxv2/mods/ChatModule.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
on_user_disconnect(app, conn_id, session=None)
async
¶
Wird aufgerufen, wenn die Verbindung eines Clients geschlossen wird.
Source code in toolboxv2/mods/ChatModule.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
register_chat_handlers(app)
¶
Registriert die asynchronen Funktionen als Handler für spezifische WebSocket-Ereignisse.
Der Funktionsname (register_chat_handlers) ist beliebig. Der Decorator ist entscheidend.
Returns:
| Type | Description |
|---|---|
dict
|
Ein Dictionary, das Ereignisnamen auf ihre Handler-Funktionen abbildet. |
Source code in toolboxv2/mods/ChatModule.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
CloudM
¶
check_multiple_processes(pids)
¶
Checks the status of multiple processes in a single system call. Returns a dictionary mapping PIDs to their status (GREEN_CIRCLE, RED_CIRCLE, or YELLOW_CIRCLE).
Source code in toolboxv2/mods/CloudM/mini.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
get_service_pids(info_dir)
¶
Extracts service names and PIDs from pid files.
Source code in toolboxv2/mods/CloudM/mini.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
get_service_status(dir)
¶
Displays the status of all services.
Source code in toolboxv2/mods/CloudM/mini.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
AdminDashboard
¶
AuthClerk
¶
ToolBox V2 - Clerk Authentication Integration Replaces AuthManager.py with Clerk-based authentication
WICHTIG: - NO Passkeys (Premium Feature in Clerk Free Tier) - Email + Code verification (keine Magic Links mit URLs) - Nur eine Session pro User erlaubt - Lokale Speicherung in BlobFile für Offline/Sync
LocalUserData
dataclass
¶
Lokale User-Daten die in BlobFile gespeichert werden (dezentral)
Source code in toolboxv2/mods/CloudM/AuthClerk.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
TokenVerificationResult
dataclass
¶
Result of token verification
Source code in toolboxv2/mods/CloudM/AuthClerk.py
231 232 233 234 235 236 237 238 | |
clear_session_token(identifier)
¶
Clear session token from BlobFile
Source code in toolboxv2/mods/CloudM/AuthClerk.py
148 149 150 151 152 153 154 155 156 157 | |
cli_check_auth(app=None, cli_session_id=None)
async
¶
CLI: Check if authentication is complete (polling endpoint)
Source code in toolboxv2/mods/CloudM/AuthClerk.py
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | |
cli_request_code(app=None, email=None)
async
¶
CLI: Request verification code via email Clerk sends the code, we track it for CLI polling
Source code in toolboxv2/mods/CloudM/AuthClerk.py
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
cli_verify_code(app=None, cli_session_id=None, code=None)
async
¶
CLI: Verify the code entered by user
Source code in toolboxv2/mods/CloudM/AuthClerk.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | |
delete_user(app=None, clerk_user_id=None)
¶
Delete a user from Clerk and local storage
Source code in toolboxv2/mods/CloudM/AuthClerk.py
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
get_clerk_client()
¶
Get or create Clerk client instance
Source code in toolboxv2/mods/CloudM/AuthClerk.py
58 59 60 61 62 63 64 65 66 | |
get_clerk_config(app=None)
async
¶
Get Clerk configuration for frontend Returns publishable key and settings
Source code in toolboxv2/mods/CloudM/AuthClerk.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
get_publishable_key()
¶
Get Clerk publishable key for frontend
Source code in toolboxv2/mods/CloudM/AuthClerk.py
69 70 71 72 73 74 | |
get_user_data(app=None, clerk_user_id=None, data=None)
async
¶
Get user data (local + synced) Combines Clerk data with local BlobFile data
Source code in toolboxv2/mods/CloudM/AuthClerk.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
list_users(app=None)
¶
List all users from Clerk
Source code in toolboxv2/mods/CloudM/AuthClerk.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
load_local_user_data(clerk_user_id)
¶
Load user data from local BlobFile
Source code in toolboxv2/mods/CloudM/AuthClerk.py
104 105 106 107 108 109 110 111 112 113 114 | |
load_session_token(identifier)
¶
Load session token from BlobFile
Source code in toolboxv2/mods/CloudM/AuthClerk.py
135 136 137 138 139 140 141 142 143 144 145 | |
on_sign_in(app=None, user_data=None)
async
¶
Webhook/Callback when user signs in via Clerk UI Creates local user data and syncs to DB
Source code in toolboxv2/mods/CloudM/AuthClerk.py
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
on_sign_out(app=None, clerk_user_id=None)
async
¶
Callback when user signs out Clears session but preserves local data
Source code in toolboxv2/mods/CloudM/AuthClerk.py
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
save_local_user_data(user_data)
¶
Save user data to local BlobFile (dezentral)
Source code in toolboxv2/mods/CloudM/AuthClerk.py
91 92 93 94 95 96 97 98 99 100 101 | |
save_session_token(identifier, token, username)
¶
Save session token to BlobFile
Source code in toolboxv2/mods/CloudM/AuthClerk.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
update_user_data(app=None, clerk_user_id=None, settings=None, level=None, mod_data=None)
async
¶
Update user data (both local and synced)
Source code in toolboxv2/mods/CloudM/AuthClerk.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
verify_session(app=None, request=None, session_token=None, clerk_user_id=None)
async
¶
Verify Clerk session token. Called by middleware/frontend to validate authentication.
Source code in toolboxv2/mods/CloudM/AuthClerk.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
verify_session_token(token, authorized_parties=None)
¶
Verify Clerk session token using the official SDK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The session token (JWT) from the frontend |
required |
authorized_parties
|
list
|
List of allowed origins (e.g., ['https://example.com']) |
None
|
Returns:
| Type | Description |
|---|---|
TokenVerificationResult
|
TokenVerificationResult with verification status and user info |
Source code in toolboxv2/mods/CloudM/AuthClerk.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
AuthManager
¶
get_user_by_name(app, username, uid='*')
¶
Get user by name - supports both Legacy and Clerk users. First tries Legacy database (USER::), then Clerk database (CLERK_USER::).
Source code in toolboxv2/mods/CloudM/AuthManager.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
DashboardAPI
¶
ToolBox V2 - Dashboard API Endpoints mit Minu Integration¶
Backend-Endpunkte für die Minu-basierten Dashboards mit: - Zuverlässige Logout-Logik - Session-Management - Event-Handling für Minu Views
handle_dashboard_event(app, request, data)
async
¶
Verarbeitet Events von Minu Dashboard Views.
POST /api/CloudM.DashboardAPI/handle_dashboard_event { "action": "logout", "payload": {...} }
Source code in toolboxv2/mods/CloudM/DashboardAPI.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
logout(app, request)
async
¶
Zuverlässiger Logout-Endpunkt.
Führt folgende Schritte aus: 1. Invalidiert Server-Session 2. Löscht Session-Cookies 3. Benachrichtigt Clerk (falls verwendet) 4. Räumt Minu-Sessions auf 5. Leitet zur Login-Seite weiter
Kann sowohl via POST (AJAX) als auch GET (Link) aufgerufen werden.
Source code in toolboxv2/mods/CloudM/DashboardAPI.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
render_admin_dashboard(app, request)
async
¶
Rendert das Admin Dashboard als Minu View.
GET /api/CloudM.DashboardAPI/render_admin_dashboard
Source code in toolboxv2/mods/CloudM/DashboardAPI.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
render_user_dashboard(app, request)
async
¶
Rendert das User Dashboard als Minu View.
GET /api/CloudM.DashboardAPI/render_user_dashboard
Source code in toolboxv2/mods/CloudM/DashboardAPI.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
LogInSystem
¶
ToolBox V2 - CLI Login System with Clerk Handles CLI authentication via Email + Code (NO browser opening)
WICHTIG: - Kein Webbrowser mehr öffnen - Direkter Code-Eingabe in CLI - BlobFile für Token-Speicherung
cli_login(app=None, email=None)
async
¶
CLI Login with Clerk Email + Code verification NO browser opening - direct code input
Source code in toolboxv2/mods/CloudM/LogInSystem.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
cli_logout(app=None)
async
¶
Logout from CLI session
Source code in toolboxv2/mods/CloudM/LogInSystem.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
cli_status(app=None)
async
¶
Show current CLI session status
Source code in toolboxv2/mods/CloudM/LogInSystem.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
open_check_cli_auth(session_id, app=None)
async
¶
Check if CLI authentication is complete (polling endpoint)
Source code in toolboxv2/mods/CloudM/LogInSystem.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
open_complete_cli_auth(session_id, user_id=None, username=None, session_token=None, app=None)
async
¶
Complete CLI authentication (called from web after Clerk sign-in)
Source code in toolboxv2/mods/CloudM/LogInSystem.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
open_web_login_web(app, request=None, session_id=None, return_to=None)
async
¶
Web login page using Clerk UI components Returns HTML that loads Clerk's sign-in component
Source code in toolboxv2/mods/CloudM/LogInSystem.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
ModManager
¶
CloudM - Advanced Module Manager Production-ready module management system with multi-platform support Version: 0.1.0
ConfigVersion
¶
Bases: Enum
Configuration file versions
Source code in toolboxv2/mods/CloudM/ModManager.py
53 54 55 56 | |
MenuCategory
dataclass
¶
Menu category.
Source code in toolboxv2/mods/CloudM/ModManager.py
1360 1361 1362 1363 1364 1365 | |
MenuItem
dataclass
¶
Menu item with action.
Source code in toolboxv2/mods/CloudM/ModManager.py
1349 1350 1351 1352 1353 1354 1355 1356 1357 | |
ModernMenuManager
¶
Modern menu manager with arrow key navigation.
Source code in toolboxv2/mods/CloudM/ModManager.py
1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 | |
add_category(category)
¶
Add a menu category.
Source code in toolboxv2/mods/CloudM/ModManager.py
1449 1450 1451 1452 | |
get_menu_text()
¶
Generate formatted menu text.
Source code in toolboxv2/mods/CloudM/ModManager.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | |
get_selected_item()
¶
Get currently selected menu item.
Source code in toolboxv2/mods/CloudM/ModManager.py
1525 1526 1527 1528 1529 | |
move_down()
¶
Move selection down.
Source code in toolboxv2/mods/CloudM/ModManager.py
1520 1521 1522 1523 | |
move_up()
¶
Move selection up.
Source code in toolboxv2/mods/CloudM/ModManager.py
1515 1516 1517 1518 | |
run()
async
¶
Run the menu manager.
Source code in toolboxv2/mods/CloudM/ModManager.py
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 | |
ModuleType
¶
Bases: Enum
Module types for different installation strategies
Source code in toolboxv2/mods/CloudM/ModManager.py
46 47 48 49 50 | |
Platform
¶
Bases: Enum
Supported platform types for module installation
Source code in toolboxv2/mods/CloudM/ModManager.py
36 37 38 39 40 41 42 43 | |
build_all_mods(app, base='mods', upload=True)
async
¶
Builds installer packages for all modules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
base
|
str
|
Base directory containing modules |
'mods'
|
upload
|
bool
|
Whether to upload packages after building |
True
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with build summary |
Source code in toolboxv2/mods/CloudM/ModManager.py
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 | |
create_and_pack_module(path, module_name='', version='-.-.-', additional_dirs=None, yaml_data=None, platform_filter=None)
¶
Creates and packs a module into a ZIP file with platform-specific support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to module directory or file |
required |
module_name
|
str
|
Name of the module |
''
|
version
|
str
|
Module version |
'-.-.-'
|
additional_dirs
|
Optional[Dict]
|
Additional directories to include |
None
|
yaml_data
|
Optional[Dict]
|
Configuration data override |
None
|
platform_filter
|
Optional[Platform]
|
Optional platform filter for packaging |
None
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Path to created ZIP file or None on failure |
Source code in toolboxv2/mods/CloudM/ModManager.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
create_module_from_blueprint(app=None, module_name='', module_type='basic', description='', version='0.0.1', location='./mods', author='', create_config=True, external=False)
async
¶
Creates a new module from blueprint template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
None
|
module_name
|
str
|
Name of the new module |
''
|
module_type
|
str
|
Type of module (basic, async_service, workflow, etc.) |
'basic'
|
description
|
str
|
Module description |
''
|
version
|
str
|
Initial version |
'0.0.1'
|
location
|
str
|
Where to create the module |
'./mods'
|
author
|
str
|
Module author |
''
|
create_config
|
bool
|
Whether to create tbConfig.yaml |
True
|
external
|
bool
|
If True, create external to toolbox structure |
False
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with creation status |
Source code in toolboxv2/mods/CloudM/ModManager.py
3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 | |
create_tb_config_single(module_name, version, file_path, description='', author='', specification=None, dependencies=None, platforms=None, metadata=None)
¶
Creates configuration for single-file modules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
str
|
Name of the module |
required |
version
|
str
|
Module version |
required |
file_path
|
str
|
Path to the single file |
required |
description
|
str
|
Module description |
''
|
author
|
str
|
Module author |
''
|
specification
|
Optional[Dict]
|
File specifications (exports, functions, etc.) |
None
|
dependencies
|
Optional[List]
|
List of dependencies |
None
|
platforms
|
Optional[List[Platform]]
|
List of supported platforms |
None
|
metadata
|
Optional[Dict]
|
Additional metadata |
None
|
Returns:
| Type | Description |
|---|---|
Dict
|
Configuration dictionary for single file module |
Source code in toolboxv2/mods/CloudM/ModManager.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
create_tb_config_v2(module_name, version, module_type=ModuleType.PACKAGE, description='', author='', license='MIT', homepage='', platforms=None, metadata=None)
¶
Creates a v2 tbConfig with platform-specific file management.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
str
|
Name of the module |
required |
version
|
str
|
Module version |
required |
module_type
|
ModuleType
|
Type of module (package/single/hybrid) |
PACKAGE
|
description
|
str
|
Module description |
''
|
author
|
str
|
Module author |
''
|
license
|
str
|
Module license |
'MIT'
|
homepage
|
str
|
Module homepage/repository |
''
|
platforms
|
Optional[Dict]
|
Platform-specific file configurations |
None
|
metadata
|
Optional[Dict]
|
Additional metadata |
None
|
Returns:
| Type | Description |
|---|---|
Dict
|
Configuration dictionary |
Source code in toolboxv2/mods/CloudM/ModManager.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
download_files(urls, directory, desc, print_func, filename=None)
¶
Downloads files from URLs with progress indication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to download |
required |
directory
|
str
|
Target directory |
required |
desc
|
str
|
Progress bar description |
required |
print_func
|
callable
|
Function for printing messages |
required |
filename
|
Optional[str]
|
Optional filename (uses basename if None) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to last downloaded file |
Source code in toolboxv2/mods/CloudM/ModManager.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
download_mod(app, module_name, platform=None)
async
¶
Downloads a module ZIP file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
module_name
|
str
|
Name of module to download |
required |
platform
|
Optional[str]
|
Optional platform filter |
None
|
Returns:
| Type | Description |
|---|---|
Result
|
Binary result with ZIP file |
Source code in toolboxv2/mods/CloudM/ModManager.py
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | |
format_status(status, message)
¶
Format status message with icon.
Source code in toolboxv2/mods/CloudM/ModManager.py
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 | |
generate_configs_for_existing_mods(app=None, root_dir='./mods', backup=True, interactive=True, overwrite=False)
async
¶
Generates tbConfig.yaml files for all existing modules in the mods directory.
Supports: - Package modules (directories) -> tbConfig.yaml (v2) - Single file modules (.py files) -> {module_name}.yaml (single)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
None
|
root_dir
|
str
|
Root directory containing modules |
'./mods'
|
backup
|
bool
|
Create backups of existing configs |
True
|
interactive
|
bool
|
Ask for confirmation before each operation |
True
|
overwrite
|
bool
|
Overwrite existing configs without asking |
False
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with generation summary |
Source code in toolboxv2/mods/CloudM/ModManager.py
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 | |
generate_single_module_config(app=None, module_name='', force=False)
async
¶
Generates config for a single specific module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
None
|
module_name
|
str
|
Name of module to generate config for |
''
|
force
|
bool
|
Force overwrite without asking |
False
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with generation status |
Source code in toolboxv2/mods/CloudM/ModManager.py
2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 | |
get_mod_info(app, module_name)
async
¶
Gets detailed information about a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
module_name
|
str
|
Name of module |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result with module information |
Source code in toolboxv2/mods/CloudM/ModManager.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | |
get_mod_version(app, module_name)
async
¶
Gets the latest version of a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
module_name
|
str
|
Name of module |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result with version string |
Source code in toolboxv2/mods/CloudM/ModManager.py
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | |
get_platform_files(config, platform)
¶
Extracts file list for specific platform from config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict
|
Module configuration dictionary |
required |
platform
|
Platform
|
Target platform |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of files for the platform |
Source code in toolboxv2/mods/CloudM/ModManager.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
increment_version(version_str, max_value=99)
¶
Increments a version number in the format "vX.Y.Z".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version_str
|
str
|
Current version number (e.g., "v0.0.1") |
required |
max_value
|
int
|
Maximum number per position (default: 99) |
99
|
Returns:
| Type | Description |
|---|---|
str
|
Incremented version number |
Raises:
| Type | Description |
|---|---|
ValueError
|
If version format is invalid |
Source code in toolboxv2/mods/CloudM/ModManager.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
install_dependencies(yaml_file, auto=False)
¶
Installs dependencies from tbConfig.yaml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yaml_file
|
str
|
Path to configuration file |
required |
auto
|
bool
|
Automatically install without confirmation |
False
|
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise |
Source code in toolboxv2/mods/CloudM/ModManager.py
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | |
install_from_zip(app, zip_name, no_dep=True, auto_dep=False, target_platform=None)
¶
Installs a module from ZIP file with dependency management.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
zip_name
|
str
|
Name of ZIP file |
required |
no_dep
|
bool
|
Skip dependency installation |
True
|
auto_dep
|
bool
|
Automatically install dependencies |
False
|
target_platform
|
Optional[Platform]
|
Optional platform filter |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise |
Source code in toolboxv2/mods/CloudM/ModManager.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | |
installer(app, module_name, build_state=True, platform=None)
async
¶
Installs or updates a module from the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
module_name
|
str
|
Name of module to install |
required |
build_state
|
bool
|
Whether to rebuild state after installation |
True
|
platform
|
Optional[Platform]
|
Optional platform filter for installation |
None
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with installation status |
Source code in toolboxv2/mods/CloudM/ModManager.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | |
interactive_manager(app=None)
async
¶
Modern interactive CLI manager for module operations.
Features: - Arrow key navigation (↑↓ or w/s) - Modern, minimalistic UI - All original functionality preserved - Better visual feedback - Elegant dialogs and prompts
Source code in toolboxv2/mods/CloudM/ModManager.py
2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 | |
list_module_templates(app=None)
¶
Lists all available module templates.
Returns:
| Type | Description |
|---|---|
Result
|
Result with template information |
Source code in toolboxv2/mods/CloudM/ModManager.py
3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 | |
list_modules(app=None)
¶
Lists all available modules.
Returns:
| Type | Description |
|---|---|
Result
|
Result with module list |
Source code in toolboxv2/mods/CloudM/ModManager.py
797 798 799 800 801 802 803 804 805 806 807 808 809 | |
load_and_validate_config(config_path)
¶
Loads and validates a configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path
|
Path to configuration file |
required |
Returns:
| Type | Description |
|---|---|
Tuple[Optional[Dict], List[str]]
|
Tuple of (config_dict or None, list_of_errors) |
Source code in toolboxv2/mods/CloudM/ModManager.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
make_installer(app, module_name, base='./mods', upload=None, platform=None)
async
¶
Creates an installer package for a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
module_name
|
str
|
Name of module to package |
required |
base
|
str
|
Base directory containing modules |
'./mods'
|
upload
|
Optional[bool]
|
Whether to upload after creation |
None
|
platform
|
Optional[Platform]
|
Optional platform filter |
None
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with package path or upload status |
Source code in toolboxv2/mods/CloudM/ModManager.py
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | |
mod_manager_ui(app)
¶
Serves the module manager web interface.
Returns:
| Type | Description |
|---|---|
Result
|
HTML result with UI |
Source code in toolboxv2/mods/CloudM/ModManager.py
2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 | |
run_command(command, cwd=None)
¶
Executes a command and returns output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
List[str]
|
Command and arguments as list |
required |
cwd
|
Optional[str]
|
Working directory for command execution |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Command stdout output |
Raises:
| Type | Description |
|---|---|
CalledProcessError
|
If command fails |
Source code in toolboxv2/mods/CloudM/ModManager.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
show_choice(title, text, choices)
async
¶
Show radio list dialog.
Source code in toolboxv2/mods/CloudM/ModManager.py
1420 1421 1422 1423 1424 1425 1426 1427 1428 | |
show_confirm(title, text)
async
¶
Show confirmation dialog.
Source code in toolboxv2/mods/CloudM/ModManager.py
1399 1400 1401 1402 1403 1404 1405 1406 | |
show_input(title, label, default='')
async
¶
Show input dialog.
Source code in toolboxv2/mods/CloudM/ModManager.py
1409 1410 1411 1412 1413 1414 1415 1416 1417 | |
show_message(title, text, style='info')
async
¶
Show a message dialog.
Source code in toolboxv2/mods/CloudM/ModManager.py
1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | |
show_progress(title, message)
async
¶
Show a simple progress message.
Source code in toolboxv2/mods/CloudM/ModManager.py
1431 1432 1433 1434 | |
uninstall_dependencies(yaml_file)
¶
Uninstalls dependencies from tbConfig.yaml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yaml_file
|
str
|
Path to configuration file |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise |
Source code in toolboxv2/mods/CloudM/ModManager.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | |
uninstall_module(path, module_name='', version='-.-.-', additional_dirs=None, yaml_data=None)
¶
Uninstalls a module by removing its directory and ZIP file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Base path containing module |
required |
module_name
|
str
|
Name of module to uninstall |
''
|
version
|
str
|
Module version |
'-.-.-'
|
additional_dirs
|
Optional[Dict]
|
Additional directories to remove |
None
|
yaml_data
|
Optional[Dict]
|
Configuration data |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise |
Source code in toolboxv2/mods/CloudM/ModManager.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | |
uninstaller(app, module_name)
¶
Uninstalls a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
module_name
|
str
|
Name of module to uninstall |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result with uninstallation status |
Source code in toolboxv2/mods/CloudM/ModManager.py
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | |
unpack_and_move_module(zip_path, base_path='./mods', module_name='', target_platform=None)
¶
Unpacks a ZIP file and moves contents with platform filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zip_path
|
str
|
Path to ZIP file |
required |
base_path
|
str
|
Base installation path |
'./mods'
|
module_name
|
str
|
Module name (extracted from ZIP if not provided) |
''
|
target_platform
|
Optional[Platform]
|
Optional platform filter for installation |
None
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Name of installed module or None on failure |
Source code in toolboxv2/mods/CloudM/ModManager.py
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
update_all_mods(app)
async
¶
Updates all installed modules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result with update summary |
Source code in toolboxv2/mods/CloudM/ModManager.py
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | |
upload(app, module_name)
async
¶
Uploads an existing module package to the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Optional[App]
|
Application instance |
required |
module_name
|
str
|
Name of module to upload |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result with upload status |
Source code in toolboxv2/mods/CloudM/ModManager.py
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 | |
upload_mod(app, request, form_data=None)
async
¶
Uploads a module ZIP file to the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
request
|
RequestData
|
Request data |
required |
form_data
|
Optional[Dict[str, Any]]
|
Form data containing file |
None
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with upload status |
Source code in toolboxv2/mods/CloudM/ModManager.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | |
validate_config(config, schema)
¶
Validates configuration against schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict
|
Configuration dictionary to validate |
required |
schema
|
Dict
|
Schema dictionary with expected types |
required |
Returns:
| Type | Description |
|---|---|
Tuple[bool, List[str]]
|
Tuple of (is_valid, list_of_errors) |
Source code in toolboxv2/mods/CloudM/ModManager.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
ModManager_tests
¶
TestModManager
¶
Bases: TestCase
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
setUp()
¶
Set up a temporary environment for each test.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
58 59 60 61 62 63 64 65 66 67 68 | |
tearDown()
¶
Clean up the temporary environment after each test.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
70 71 72 73 | |
test_create_pack_unpack_cycle()
¶
Tests the full cycle of creating, packing, and unpacking a module.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
test_increment_version()
¶
Tests the version increment logic.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
47 48 49 50 51 52 53 54 55 56 | |
test_install_from_zip()
¶
Tests the install_from_zip helper function.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
run_mod_manager_tests(app)
¶
This function will be automatically discovered and run by the test runner. It uses the standard unittest framework to run tests.
Source code in toolboxv2/mods/CloudM/ModManager_tests.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
UserAccountManager
¶
ToolBox V2 - User Account Manager Benutzerkonten-Verwaltung mit Clerk-Integration Stellt API-Endpunkte für Dashboard und programmatischen Zugriff bereit
delete_mod_data(app, request, mod_name, keys=None)
async
¶
Mod-Daten löschen (bestimmte Keys oder alle).
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
get_account_section_html(app, request)
async
¶
HTML für den Account-Bereich im Dashboard generieren.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
get_current_user(app, request)
async
¶
API-Endpunkt: Aktuelle Benutzerdaten abrufen. Gibt öffentliche Benutzerdaten für Frontend zurück.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
get_current_user_api_wrapper(app, request)
async
¶
Wrapper für Abwärtskompatibilität
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
144 145 146 147 148 | |
get_current_user_from_request(app, request)
async
¶
Holt den aktuellen Benutzer aus der Request-Session. Funktioniert mit Clerk und Legacy-Auth.
Returns:
| Type | Description |
|---|---|
|
User-Objekt (LocalUserData oder legacy User) oder None |
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
get_mod_data(app, request, mod_name)
async
¶
Mod-spezifische Daten für den aktuellen Benutzer abrufen.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
get_user_mod_data(app, request, mod_name)
async
¶
Convenience-Funktion: Mod-Daten für einen bestimmten Mod abrufen.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
515 516 517 518 519 520 521 522 523 524 525 526 527 | |
get_user_settings(app, request)
async
¶
Convenience-Funktion: Nur Benutzereinstellungen abrufen.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
505 506 507 508 509 510 511 512 | |
set_user_mod_data(app, request, mod_name, data)
async
¶
Convenience-Funktion: Mod-Daten speichern. Gibt True bei Erfolg zurück.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
530 531 532 533 534 535 536 | |
update_email(app, request, new_email=None)
async
¶
E-Mail-Adresse aktualisieren. Bei Clerk: Weiterleitung zu Clerk-Profil.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
update_mod_data(app, request, mod_name, data)
async
¶
Mod-spezifische Daten für den aktuellen Benutzer aktualisieren.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
update_setting(app, request, setting_key, setting_value)
async
¶
Einzelne Benutzereinstellung aktualisieren. Gibt HTML für HTMX-Update zurück.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
update_settings_batch(app, request, settings)
async
¶
Mehrere Einstellungen auf einmal aktualisieren.
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
UserDashboard
¶
ToolBox V2 - Enhanced User Dashboard Benutzerfreundliches Dashboard für: - Profil-Verwaltung - Mod-Interaktion und Konfiguration - Einstellungen ohne technisches Wissen - Appearance/Theme-Customization
add_module_to_instance(app, request, data=None, module_name=Name)
async
¶
Modul zur Benutzer-Instanz hinzufügen und laden
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 | |
add_module_to_saved(app, request, data=None, module_name=Name)
async
¶
Modul zu den gespeicherten Modulen hinzufügen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | |
close_cli_session(app, request, data)
async
¶
CLI-Sitzung schließen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 | |
delete_user_file(app, request, data=None, path=None)
async
¶
Datei für Benutzer löschen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 | |
download_user_file(app, request, data=None, **kwargs)
async
¶
Datei für Benutzer herunterladen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 | |
get_all_available_modules(app, request)
async
¶
Liste aller verfügbaren Module für den Benutzer
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 | |
get_all_mod_data(app, request)
async
¶
Alle Mod-Daten des aktuellen Benutzers abrufen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 | |
get_my_active_instances(app, request)
async
¶
Aktive Instanzen des aktuellen Benutzers abrufen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 | |
get_user_dashboard_main_page(app, request)
async
¶
Haupt-Dashboard Seite - Modern, Tab-basiert, vollständig responsive
Source code in toolboxv2/mods/CloudM/UserDashboard.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 | |
list_user_files(app, request, data=None)
async
¶
Liste alle Dateien des Benutzers auf
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 | |
remove_module_from_instance(app, request, data=None, module_name=Name)
async
¶
Modul aus Benutzer-Instanz entladen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 | |
remove_module_from_saved(app, request, data)
async
¶
Modul aus den gespeicherten Modulen entfernen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 | |
request_my_magic_link(app, request)
async
¶
Magic Link für den aktuellen Benutzer anfordern
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 | |
update_my_settings(app, request, data)
async
¶
Benutzereinstellungen aktualisieren
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 | |
upload_user_file(app, request, data=None, **kwargs)
async
¶
Datei für Benutzer hochladen
Source code in toolboxv2/mods/CloudM/UserDashboard.py
2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 | |
UserDataAPI
¶
ToolBox V2 - Unified User Data API Vereinheitlichte Schnittstelle für Mod-zu-Mod Datenzugriff mit Scoped Storage
SCOPES: - PUBLIC_READ: Alle lesen, nur Admin schreibt - PUBLIC_RW: Alle lesen/schreiben - USER_PUBLIC: Alle lesen, nur Owner schreibt unter eigenem Prefix - USER_PRIVATE: Nur Owner (lokal + verschlüsselter Cloud-Sync) - SERVER_SCOPE: Server-spezifische Daten - MOD_DATA: Modul-spezifische Daten
Features: - Berechtigungsbasierter Zugriff auf Daten anderer Mods - Audit-Log für Datenzugriffe - Lokale Speicherung für USER_PRIVATE - Caching für andere Scopes - Integration mit Clerk Auth
DataAccessLog
dataclass
¶
Audit-Log Eintrag für Datenzugriff
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
87 88 89 90 91 92 93 94 95 96 97 | |
ModDataClient
¶
Hilfsklasse für einfachen Zugriff auf Mod-Daten
Usage
client = ModDataClient(app, request, 'MyModName')
Eigene Daten¶
data = await client.get() await client.set({'key': 'value'})
Andere Scopes¶
public = await client.get_public('announcement.json') await client.set_shared('profile.json', {'name': 'Test'})
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
get(key=None)
async
¶
Eigene Mod-Daten abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
971 972 973 974 975 976 977 978 | |
get_from(target_mod, key=None)
async
¶
Daten eines anderen Mods abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
990 991 992 993 994 995 996 997 998 | |
get_private(path)
async
¶
Private Daten abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
1000 1001 1002 1003 1004 1005 1006 1007 | |
get_public(path)
async
¶
Public read Daten abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
1019 1020 1021 1022 1023 1024 1025 1026 | |
get_shared(path, owner_id=None)
async
¶
User public Daten abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
1028 1029 1030 1031 1032 1033 1034 1035 1036 | |
set(data, merge=True)
async
¶
Eigene Mod-Daten speichern
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
980 981 982 983 984 985 986 987 988 | |
set_private(path, data)
async
¶
Private Daten speichern
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
1009 1010 1011 1012 1013 1014 1015 1016 1017 | |
set_shared(path, data)
async
¶
Eigene shared Daten speichern
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
ModPermission
dataclass
¶
Berechtigung für Mod-Datenzugriff
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
74 75 76 77 78 79 80 81 82 83 84 | |
StorageProvider
¶
Zentrale Storage-Verwaltung pro User
Verwaltet: - ScopedBlobStorage Instanz pro User - Mod-Permissions - Audit Logging
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
check_mod_permission(source_mod, target_mod, permission_type, key=None)
¶
Prüft Mod-zu-Mod Berechtigung
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_mod
|
str
|
Anfragende Mod |
required |
target_mod
|
str
|
Ziel-Mod |
required |
permission_type
|
str
|
'read', 'write', 'delete' |
required |
key
|
str
|
Optionaler spezifischer Key |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True wenn berechtigt |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
get_access_log(limit=50)
¶
Holt Access Log
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
311 312 313 314 315 316 317 318 | |
get_instance(user_context, minio_endpoint=None, minio_access_key=None, minio_secret_key=None, local_db_path=None)
classmethod
¶
Singleton pro User
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
grant_permission(source_mod, target_mod, permission_type='read', keys=None, expires_hours=0, reason='')
¶
Erteilt Mod-Permission
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
list_permissions()
¶
Listet alle Permissions
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
307 308 309 | |
revoke_permission(source_mod, target_mod)
¶
Widerruft Mod-Permission
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
299 300 301 302 303 304 305 | |
delete_data(app, request, path, scope='private', mod_name=None)
async
¶
Löscht Daten
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Pfad zur Datei |
required |
scope
|
str
|
Storage Scope |
'private'
|
mod_name
|
str
|
Modulname |
None
|
Returns:
| Type | Description |
|---|---|
|
Result |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
get_access_log(app, request, limit=50)
async
¶
Zugriffs-Log abrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
917 918 919 920 921 922 923 924 925 926 | |
get_data(app, request, path, scope='private', mod_name=None, owner_id=None)
async
¶
Universelle Daten-Abruf Funktion
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Pfad zur Datei (relativ) |
required |
scope
|
str
|
Storage Scope (public_read, public_rw, user_public, user_private, mod_data) |
'private'
|
mod_name
|
str
|
Modulname (nur für mod_data scope) |
None
|
owner_id
|
str
|
Owner-ID (für Zugriff auf fremde public Daten) |
None
|
Returns:
| Type | Description |
|---|---|
|
Result mit Daten |
Examples:
Private Daten lesen¶
result = await app.a_run_any('CloudM.UserDataAPI.get_data', path='settings.json', scope='private')
Public shared Daten eines anderen Users¶
result = await app.a_run_any('CloudM.UserDataAPI.get_data', path='profile.json', scope='user_public', owner_id='other_user_id')
Mod-Daten¶
result = await app.a_run_any('CloudM.UserDataAPI.get_data', path='config.json', scope='mod_data', mod_name='MyMod')
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | |
get_mod_data(app, request, source_mod, target_mod=None, key=None)
async
¶
Mod-Daten abrufen (Legacy API Kompatibilität)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_mod
|
str
|
Name des anfragenden Moduls |
required |
target_mod
|
str
|
Name des Ziel-Moduls (default: source_mod) |
None
|
key
|
str
|
Optionaler spezifischer Schlüssel |
None
|
Returns:
| Type | Description |
|---|---|
|
Result mit Daten |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | |
grant_permission(app, request, source_mod, target_mod, permission_type='read', keys=None, expires_hours=0)
async
¶
Berechtigung erteilen (vom Benutzer aufgerufen)
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | |
list_data(app, request, prefix='', scope='private', mod_name=None, owner_id=None)
async
¶
Listet Daten in einem Pfad
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Pfad-Prefix |
''
|
scope
|
str
|
Storage Scope |
'private'
|
mod_name
|
str
|
Modulname |
None
|
owner_id
|
str
|
Owner-ID für fremde Daten |
None
|
Returns:
| Type | Description |
|---|---|
|
Result mit Liste von Metadaten |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
list_permissions(app, request)
async
¶
Alle Berechtigungen auflisten
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
905 906 907 908 909 910 911 912 913 914 | |
request_permission(app, request, source_mod, target_mod, permission_type='read', reason='')
async
¶
Berechtigung für Zugriff auf andere Mod-Daten anfordern
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | |
revoke_permission(app, request, source_mod, target_mod)
async
¶
Berechtigung widerrufen
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | |
set_data(app, request, path, data, scope='private', mod_name=None, content_type='application/json')
async
¶
Universelle Daten-Speicher Funktion
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Pfad zur Datei (relativ) |
required |
data
|
Any
|
Zu speichernde Daten (dict, list, str, bytes) |
required |
scope
|
str
|
Storage Scope |
'private'
|
mod_name
|
str
|
Modulname (nur für mod_data scope) |
None
|
content_type
|
str
|
MIME Type |
'application/json'
|
Returns:
| Type | Description |
|---|---|
|
Result mit Metadaten |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
set_mod_data(app, request, source_mod, data, target_mod=None, key=None, merge=True)
async
¶
Mod-Daten speichern (Legacy API Kompatibilität)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_mod
|
str
|
Name des anfragenden Moduls |
required |
data
|
Dict
|
Zu speichernde Daten |
required |
target_mod
|
str
|
Name des Ziel-Moduls (default: source_mod) |
None
|
key
|
str
|
Optionaler spezifischer Schlüssel |
None
|
merge
|
bool
|
Daten mergen statt überschreiben |
True
|
Returns:
| Type | Description |
|---|---|
|
Result |
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
sync(app, request)
async
¶
Synchronisiert private Daten mit Cloud
Source code in toolboxv2/mods/CloudM/UserDataAPI.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | |
UserInstances
¶
User Instance Management with Clerk Integration Handles web and CLI sessions, user instances, and session lifecycle
UserInstances
¶
Singleton class managing all user instances and sessions. Supports both web (WebSocket) and CLI sessions.
Source code in toolboxv2/mods/CloudM/UserInstances.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
get_clerk_session_key(clerk_user_id)
staticmethod
¶
Generate Clerk Session Key for mapping
Source code in toolboxv2/mods/CloudM/UserInstances.py
67 68 69 70 71 | |
get_cli_session_id(uid)
staticmethod
¶
Generate CLI Session ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
61 62 63 64 65 | |
get_si_id(uid)
staticmethod
¶
Generate Session Instance ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
43 44 45 46 47 | |
get_vt_id(uid)
staticmethod
¶
Generate Virtual Instance ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
49 50 51 52 53 | |
get_web_socket_id(uid)
staticmethod
¶
Generate WebSocket ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
55 56 57 58 59 | |
cleanup_expired_cli_sessions(max_age_hours=24)
¶
Clean up expired CLI sessions
Source code in toolboxv2/mods/CloudM/UserInstances.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
close_cli_session(cli_session_id)
¶
Close a CLI session
Source code in toolboxv2/mods/CloudM/UserInstances.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
close_user_instance(uid)
¶
Close a user's web instance and save state
Source code in toolboxv2/mods/CloudM/UserInstances.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
delete_user_instance(uid)
¶
Delete a user instance completely
Source code in toolboxv2/mods/CloudM/UserInstances.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
get_all_active_cli_sessions()
¶
Get all active CLI sessions
Source code in toolboxv2/mods/CloudM/UserInstances.py
414 415 416 417 418 419 420 421 | |
get_cli_session_by_clerk_id(clerk_user_id)
¶
Get CLI session by Clerk user ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
401 402 403 404 405 406 407 408 409 410 411 | |
get_instance_overview(si_id=None)
¶
Get comprehensive overview of all instances and sessions
Source code in toolboxv2/mods/CloudM/UserInstances.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
get_instance_si_id(si_id)
¶
Get live instance by Session Instance ID
Source code in toolboxv2/mods/CloudM/UserInstances.py
178 179 180 181 | |
get_user_cli_sessions(uid)
¶
Get all CLI sessions for a user
Source code in toolboxv2/mods/CloudM/UserInstances.py
386 387 388 389 390 391 392 393 394 395 396 397 398 | |
get_user_instance(uid, hydrate=True)
¶
Get or create a user instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uid
|
str
|
User identifier (can be Clerk user ID or legacy UID) |
required |
hydrate
|
bool
|
Whether to load modules into the instance |
True
|
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Instance dictionary with session info and loaded modules |
Source code in toolboxv2/mods/CloudM/UserInstances.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
get_user_instance_with_cli_sessions(uid, hydrate=True)
¶
Get user instance with CLI sessions included
Source code in toolboxv2/mods/CloudM/UserInstances.py
445 446 447 448 449 450 451 452 453 454 455 456 457 | |
hydrate_instance(instance)
¶
Load modules into an instance
Source code in toolboxv2/mods/CloudM/UserInstances.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
register_cli_session(uid, session_token, session_info=None, clerk_user_id=None)
¶
Register a new CLI session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uid
|
str
|
User identifier |
required |
session_token
|
str
|
JWT or session token |
required |
session_info
|
Optional[dict]
|
Additional session metadata |
None
|
clerk_user_id
|
Optional[str]
|
Clerk user ID if using Clerk auth |
None
|
Returns:
| Type | Description |
|---|---|
Result
|
Result with session data |
Source code in toolboxv2/mods/CloudM/UserInstances.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
save_close_user_instance(ws_id)
¶
Validate WebSocket ID and close associated instance
Source code in toolboxv2/mods/CloudM/UserInstances.py
495 496 497 498 499 500 501 502 503 504 505 506 507 | |
save_user_instances(instance)
¶
Save user instance to memory and database
Source code in toolboxv2/mods/CloudM/UserInstances.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
update_cli_session_activity(cli_session_id)
¶
Update last activity timestamp for CLI session
Source code in toolboxv2/mods/CloudM/UserInstances.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
validate_cli_session_token(cli_session_id, token)
¶
Validate CLI session token
Source code in toolboxv2/mods/CloudM/UserInstances.py
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
validate_ws_id(ws_id)
¶
Validate WebSocket ID and return (is_valid, session_key)
Source code in toolboxv2/mods/CloudM/UserInstances.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
email_services
¶
send_email_verification_email(app, user_email, username, verification_url)
¶
Sends an email verification link to the user.
Source code in toolboxv2/mods/CloudM/email_services.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
send_magic_link_email(app, user_email, magic_link_url, username=None)
¶
Sends a magic link email for login.
Source code in toolboxv2/mods/CloudM/email_services.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
send_signup_invitation_email(app, invited_user_email, invited_username, inviter_username=None)
¶
Generates an invitation link and sends it via email.
Source code in toolboxv2/mods/CloudM/email_services.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
send_waiting_list_confirmation_email(app, user_email)
¶
Sends a confirmation email for joining the waiting list.
Source code in toolboxv2/mods/CloudM/email_services.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
send_welcome_email(app, user_email, username, welcome_action_url=None)
¶
Sends a welcome email to a new user.
Source code in toolboxv2/mods/CloudM/email_services.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
extras
¶
CloudM Extra Functions with Clerk Integration Provides utility functions, UI registration, and initialization
add_ui(app, name, title, path, description, auth=False, icon='apps', bg_img_url=None)
¶
Register a UI component in the CloudM UI registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
name
|
str
|
Unique name for the UI |
required |
title
|
str
|
Display title |
required |
path
|
str
|
API path to load the UI |
required |
description
|
str
|
Description of the UI |
required |
auth
|
bool
|
Whether authentication is required |
False
|
Source code in toolboxv2/mods/CloudM/extras.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
cleanup_dashboard_api(app)
¶
Entfernt UIs beim Entladen des Moduls.
Source code in toolboxv2/mods/CloudM/extras.py
456 457 458 | |
clear_db(self, do_root=False)
¶
Clear the database (use with caution!)
Source code in toolboxv2/mods/CloudM/extras.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
create_account(self)
¶
Open signup page in browser
Source code in toolboxv2/mods/CloudM/extras.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
create_magic_log_in(app, username)
¶
Create magic login URL for a user. Note: With Clerk, this is replaced by email code verification.
Source code in toolboxv2/mods/CloudM/extras.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
docs(app=None)
¶
Show APP api documentation
Source code in toolboxv2/mods/CloudM/extras.py
407 408 409 410 411 412 413 414 415 | |
get_eco(app=None, request=None)
async
¶
Debug endpoint - returns request info
Source code in toolboxv2/mods/CloudM/extras.py
417 418 419 420 | |
init_git(_)
¶
Initialize git repository
Source code in toolboxv2/mods/CloudM/extras.py
185 186 187 188 189 190 191 192 193 194 195 | |
initialize_admin_panel(app)
¶
Initialize the CloudM admin panel. Registers UI components and sets up initial configuration.
Source code in toolboxv2/mods/CloudM/extras.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
new_module(self, mod_name, *options)
¶
Create a new module from boilerplate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mod_name
|
str
|
Name of the new module |
required |
*options
|
Additional options (-fh for FileHandler, -func for functional style) |
()
|
Source code in toolboxv2/mods/CloudM/extras.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
openVersion(self)
¶
Return module version
Source code in toolboxv2/mods/CloudM/extras.py
67 68 69 70 | |
openui(app)
¶
Get all registered UIs
Source code in toolboxv2/mods/CloudM/extras.py
56 57 58 59 60 61 62 63 64 | |
register_initial_loot_user(app, email=None, user_name='loot')
async
¶
Register initial admin user. With Clerk, this guides user to web registration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
email
|
str
|
User email (optional, prompts if not provided) |
None
|
user_name
|
str
|
Username for the admin account |
'loot'
|
Returns:
| Type | Description |
|---|---|
|
Result with registration URL or instructions |
Source code in toolboxv2/mods/CloudM/extras.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
show_version(self)
¶
Show module version
Source code in toolboxv2/mods/CloudM/extras.py
399 400 401 402 403 | |
update_core(self, backup=False, name='')
¶
Update ToolBox core
Source code in toolboxv2/mods/CloudM/extras.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
update_core_git(self, backup=False, name='base')
¶
Update via git
Source code in toolboxv2/mods/CloudM/extras.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
update_core_pip(self)
¶
Update via pip
Source code in toolboxv2/mods/CloudM/extras.py
226 227 228 229 | |
mini
¶
check_multiple_processes(pids)
¶
Checks the status of multiple processes in a single system call. Returns a dictionary mapping PIDs to their status (GREEN_CIRCLE, RED_CIRCLE, or YELLOW_CIRCLE).
Source code in toolboxv2/mods/CloudM/mini.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
get_service_pids(info_dir)
¶
Extracts service names and PIDs from pid files.
Source code in toolboxv2/mods/CloudM/mini.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
get_service_status(dir)
¶
Displays the status of all services.
Source code in toolboxv2/mods/CloudM/mini.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
models
¶
CloudM Authentication Models - Pydantic Models for Type Safety Version: 2.0.0
Diese Datei enthält die neuen Pydantic Models für das modernisierte Auth-System. Ersetzt die alten dataclass-basierten User-Modelle mit sauberer Typisierung.
ChallengeData
¶
Bases: BaseModel
Temporary challenge data for WebAuthn flows
Source code in toolboxv2/mods/CloudM/models.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
is_expired()
¶
Check if challenge is expired
Source code in toolboxv2/mods/CloudM/models.py
138 139 140 | |
validate_challenge_type(v)
classmethod
¶
Validate challenge type
Source code in toolboxv2/mods/CloudM/models.py
130 131 132 133 134 135 136 | |
LegacyUser
¶
Bases: BaseModel
Legacy User Model für Migration. Enthält alte Felder für Kompatibilität.
Source code in toolboxv2/mods/CloudM/models.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
SessionToken
¶
Bases: BaseModel
JWT Token Claims
Source code in toolboxv2/mods/CloudM/models.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
validate_token_type(v)
classmethod
¶
Validate token type
Source code in toolboxv2/mods/CloudM/models.py
110 111 112 113 114 115 116 117 | |
TokenType
¶
Token type constants
Source code in toolboxv2/mods/CloudM/models.py
92 93 94 95 96 97 | |
User
¶
Bases: UserBase
Vollständiges User Model mit WebAuthn Credentials. KEINE user_pass_pri, user_pass_pub, user_pass_sync mehr!
Source code in toolboxv2/mods/CloudM/models.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
get_credential_by_id(credential_id)
¶
Find credential by ID
Source code in toolboxv2/mods/CloudM/models.py
68 69 70 71 72 73 | |
update_credential_sign_count(credential_id, new_count)
¶
Update sign count for credential (anti-cloning protection)
Source code in toolboxv2/mods/CloudM/models.py
75 76 77 78 79 80 81 82 | |
UserBase
¶
Bases: BaseModel
Base User Model - Nur WebAuthn, keine Custom Crypto
Source code in toolboxv2/mods/CloudM/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
validate_username(v)
classmethod
¶
Validate username format
Source code in toolboxv2/mods/CloudM/models.py
50 51 52 53 54 55 56 | |
WebAuthnCredential
¶
Bases: BaseModel
Speichert ein WebAuthn/Passkey Credential. Basiert auf FIDO2 Standard.
Source code in toolboxv2/mods/CloudM/models.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
module
¶
hash_password(password)
¶
Hash a password for storing.
Source code in toolboxv2/mods/CloudM/module.py
111 112 113 114 115 116 117 | |
verify_password(stored_password, provided_password)
¶
Verify a stored password against one provided by user
Source code in toolboxv2/mods/CloudM/module.py
121 122 123 124 125 126 127 128 | |
schemas
¶
CloudM Authentication API Schemas - Request/Response DTOs Version: 2.0.0
Diese Datei enthält alle Request/Response Models für die Auth-API. Eliminiert dict-Zugriffe und sorgt für saubere Typisierung.
AuthFinishRequest
¶
Bases: BaseModel
Request to complete WebAuthn authentication
Source code in toolboxv2/mods/CloudM/schemas.py
58 59 60 61 62 | |
AuthFinishResponse
¶
Bases: BaseModel
Response after successful authentication
Source code in toolboxv2/mods/CloudM/schemas.py
65 66 67 68 69 70 | |
AuthStartRequest
¶
Bases: BaseModel
Request to start WebAuthn authentication
Source code in toolboxv2/mods/CloudM/schemas.py
47 48 49 | |
AuthStartResponse
¶
Bases: BaseModel
Response with WebAuthn authentication options
Source code in toolboxv2/mods/CloudM/schemas.py
52 53 54 55 | |
CLILoginApproveRequest
¶
Bases: BaseModel
Request to approve CLI login (from browser)
Source code in toolboxv2/mods/CloudM/schemas.py
138 139 140 141 | |
CLILoginStartRequest
¶
Bases: BaseModel
Request to start CLI login flow
Source code in toolboxv2/mods/CloudM/schemas.py
115 116 117 | |
CLILoginStartResponse
¶
Bases: BaseModel
Response with approval URL
Source code in toolboxv2/mods/CloudM/schemas.py
120 121 122 123 | |
CLILoginStatusRequest
¶
Bases: BaseModel
Request to check CLI login status
Source code in toolboxv2/mods/CloudM/schemas.py
126 127 128 | |
CLILoginStatusResponse
¶
Bases: BaseModel
Response with login status
Source code in toolboxv2/mods/CloudM/schemas.py
131 132 133 134 135 | |
DeviceInviteRequest
¶
Bases: BaseModel
Request to create device invitation link
Source code in toolboxv2/mods/CloudM/schemas.py
89 90 91 92 | |
DeviceInviteResponse
¶
Bases: BaseModel
Response with magic link
Source code in toolboxv2/mods/CloudM/schemas.py
95 96 97 98 99 100 | |
DeviceListResponse
¶
Bases: BaseModel
Response with list of user's devices
Source code in toolboxv2/mods/CloudM/schemas.py
103 104 105 | |
DeviceRemoveRequest
¶
Bases: BaseModel
Request to remove a device
Source code in toolboxv2/mods/CloudM/schemas.py
108 109 110 | |
ErrorResponse
¶
Bases: BaseModel
Standard error response
Source code in toolboxv2/mods/CloudM/schemas.py
168 169 170 171 172 173 | |
MagicLinkConsumeRequest
¶
Bases: BaseModel
Request to consume magic link token
Source code in toolboxv2/mods/CloudM/schemas.py
161 162 163 | |
MagicLinkRequest
¶
Bases: BaseModel
Request to send magic link email
Source code in toolboxv2/mods/CloudM/schemas.py
146 147 148 149 | |
MagicLinkResponse
¶
Bases: BaseModel
Response after magic link sent
Source code in toolboxv2/mods/CloudM/schemas.py
152 153 154 155 156 157 158 | |
RegistrationFinishRequest
¶
Bases: BaseModel
Request to complete WebAuthn registration
Source code in toolboxv2/mods/CloudM/schemas.py
29 30 31 32 33 34 | |
RegistrationFinishResponse
¶
Bases: BaseModel
Response after successful registration
Source code in toolboxv2/mods/CloudM/schemas.py
37 38 39 40 41 42 | |
RegistrationStartRequest
¶
Bases: BaseModel
Request to start WebAuthn registration
Source code in toolboxv2/mods/CloudM/schemas.py
15 16 17 18 19 20 | |
RegistrationStartResponse
¶
Bases: BaseModel
Response with WebAuthn registration options
Source code in toolboxv2/mods/CloudM/schemas.py
23 24 25 26 | |
TokenRefreshRequest
¶
Bases: BaseModel
Request to refresh access token
Source code in toolboxv2/mods/CloudM/schemas.py
75 76 77 | |
TokenRefreshResponse
¶
Bases: BaseModel
Response with new access token
Source code in toolboxv2/mods/CloudM/schemas.py
80 81 82 83 84 | |
CodeVerification
¶
VerificationSystem
¶
Source code in toolboxv2/mods/CodeVerification.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
__init__(tools_db, scope='main')
¶
Initialize VerificationSystem with DB Tools integration
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tools_db
|
Tools
|
Database tools from toolboxv2.mods.DB |
required |
scope
|
str
|
Scope for templates and codes. Defaults to "main". |
'main'
|
Source code in toolboxv2/mods/CodeVerification.py
27 28 29 30 31 32 33 34 35 36 37 38 | |
add_config_template(template)
¶
Add a new configuration template to the database
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
ConfigTemplate
|
The configuration template |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Unique identifier of the template |
Source code in toolboxv2/mods/CodeVerification.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
generate_code(template_id)
¶
Generate a code based on the configuration template
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
ID of the configuration template |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Generated verification code |
Source code in toolboxv2/mods/CodeVerification.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
reset_scope_templates()
¶
Ensure a templates dictionary exists for the current scope in the database
Source code in toolboxv2/mods/CodeVerification.py
43 44 45 46 47 48 49 | |
validate_code(code)
¶
Validate a code and return template information
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Code to validate |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Optional[Dict[str, Any]]: Template information for valid code, else None |
Source code in toolboxv2/mods/CodeVerification.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
DB
¶
blob_instance
¶
ToolBox V2 - BlobDB für Server Storage Key-Value Datenbank basierend auf MinIO für Server-Daten
Features: - Nur SERVER_SCOPE (tb-servers Bucket) - Konfiguration via Environment Variables - Lokaler MinIO + optionaler Cloud Sync - Offline-Modus mit SQLite Fallback - Cache mit TTL - Manifest-Tracking
Environment Variables: - MINIO_ENDPOINT: Lokaler MinIO Endpoint (default: 127.0.0.1:9000) - MINIO_ACCESS_KEY: Lokaler MinIO Access Key (default: admin) - MINIO_SECRET_KEY: Lokaler MinIO Secret Key (required) - MINIO_SECURE: HTTPS verwenden (default: false)
- CLOUD_ENDPOINT: Cloud MinIO Endpoint (optional, für Sync)
- CLOUD_ACCESS_KEY: Cloud MinIO Access Key
- CLOUD_SECRET_KEY: Cloud MinIO Secret Key
-
CLOUD_SECURE: Cloud HTTPS verwenden (default: true)
-
IS_OFFLINE_DB: Nur SQLite, kein MinIO (default: false)
- SERVER_ID: Server Identifier (default: hostname)
- DB_CACHE_TTL: Cache TTL in Sekunden (default: 60)
BlobDB
¶
Bases: DB
Server Blob Database mit MinIO Backend
Verwendet tb-servers Bucket für Server-spezifische Daten. Konfiguration erfolgt über Environment Variables.
Features: - Lokaler MinIO + optionaler Cloud Sync - SQLite Fallback für Offline-Modus - Cache mit TTL - Manifest für schnelle Key-Suche
Environment Variables: - MINIO_ENDPOINT, MINIO_ACCESS_KEY, MINIO_SECRET_KEY - CLOUD_ENDPOINT, CLOUD_ACCESS_KEY, CLOUD_SECRET_KEY - IS_OFFLINE_DB, SERVER_ID, DB_CACHE_TTL
Source code in toolboxv2/mods/DB/blob_instance.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | |
append_on_set(query, value)
¶
Fügt Daten zu einer Liste hinzu oder erstellt sie.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Key |
required |
value
|
Wert oder Liste |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result |
Source code in toolboxv2/mods/DB/blob_instance.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | |
clear_cache()
¶
Löscht lokalen Cache
Source code in toolboxv2/mods/DB/blob_instance.py
1103 1104 1105 | |
delete(query, matching=False)
¶
Löscht Schlüssel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Key oder Pattern |
required |
matching
|
Pattern-Matching aktivieren |
False
|
Returns:
| Type | Description |
|---|---|
Result
|
Result mit Anzahl gelöschter Keys |
Source code in toolboxv2/mods/DB/blob_instance.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | |
exit()
¶
Schließt alle Verbindungen
Source code in toolboxv2/mods/DB/blob_instance.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 | |
get(query)
¶
Lädt Daten. Unterstützt Wildcards (*) für Pattern-Matching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Key oder Pattern (z.B. "users/*", "config") |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result mit Daten |
Source code in toolboxv2/mods/DB/blob_instance.py
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | |
get_stats()
¶
Gibt Statistiken zurück
Source code in toolboxv2/mods/DB/blob_instance.py
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | |
if_exist(query)
¶
Prüft Existenz über Manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Key oder Pattern |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True wenn existiert |
Source code in toolboxv2/mods/DB/blob_instance.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |
initialize(db_path=None, **kwargs)
¶
Initialisiert die DB mit Environment-Konfiguration
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_path
|
str
|
Optional - Prefix für Keys (default: SERVER_ID) |
None
|
**kwargs
|
Ignoriert (für Kompatibilität) |
{}
|
Returns:
| Type | Description |
|---|---|
Result
|
Result |
Source code in toolboxv2/mods/DB/blob_instance.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
reload_manifest()
¶
Lädt Manifest neu
Source code in toolboxv2/mods/DB/blob_instance.py
1107 1108 1109 1110 | |
set(query, value)
¶
Speichert Daten sofort persistent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Key (z.B. "users/123", "config") |
required |
value
|
Zu speichernde Daten |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result |
Source code in toolboxv2/mods/DB/blob_instance.py
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | |
sync_from_cloud()
¶
Synchronisiert Cloud-Daten lokal
Returns:
| Type | Description |
|---|---|
Result
|
Result mit Sync-Statistiken |
Source code in toolboxv2/mods/DB/blob_instance.py
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 | |
sync_to_cloud()
¶
Synchronisiert lokale Daten zur Cloud
Returns:
| Type | Description |
|---|---|
Result
|
Result mit Sync-Statistiken |
Source code in toolboxv2/mods/DB/blob_instance.py
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
Config
¶
Konfiguration aus Environment Variables
Source code in toolboxv2/mods/DB/blob_instance.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
has_cloud_minio()
classmethod
¶
Prüft ob Cloud MinIO konfiguriert ist
Source code in toolboxv2/mods/DB/blob_instance.py
100 101 102 103 | |
has_local_minio()
classmethod
¶
Prüft ob lokaler MinIO konfiguriert ist
Source code in toolboxv2/mods/DB/blob_instance.py
95 96 97 98 | |
reload()
classmethod
¶
Lädt Konfiguration neu aus Environment
Source code in toolboxv2/mods/DB/blob_instance.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
to_dict()
classmethod
¶
Gibt Konfiguration als Dict zurück (ohne Secrets)
Source code in toolboxv2/mods/DB/blob_instance.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
DB
¶
Bases: ABC
Abstract Database Interface
Source code in toolboxv2/mods/DB/blob_instance.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
append_on_set(query, value)
abstractmethod
¶
Append to list or create
Source code in toolboxv2/mods/DB/blob_instance.py
353 354 355 | |
delete(query, matching=False)
abstractmethod
¶
Delete by key or pattern
Source code in toolboxv2/mods/DB/blob_instance.py
357 358 359 | |
exit()
abstractmethod
¶
Close connection
Source code in toolboxv2/mods/DB/blob_instance.py
365 366 367 | |
get(query)
abstractmethod
¶
Get data by key
Source code in toolboxv2/mods/DB/blob_instance.py
345 346 347 | |
if_exist(query)
abstractmethod
¶
Check if key exists
Source code in toolboxv2/mods/DB/blob_instance.py
361 362 363 | |
set(query, value)
abstractmethod
¶
Set data by key
Source code in toolboxv2/mods/DB/blob_instance.py
349 350 351 | |
SQLiteCache
¶
SQLite-basierter Offline-Storage
Source code in toolboxv2/mods/DB/blob_instance.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
create_db(db_path=None)
¶
Factory für BlobDB
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_path
|
str
|
Optional Key-Prefix (default: SERVER_ID aus ENV) |
None
|
Returns:
| Type | Description |
|---|---|
BlobDB
|
Initialisierte BlobDB |
Source code in toolboxv2/mods/DB/blob_instance.py
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | |
local_instance
¶
load_from_json(filename)
¶
Lädt Daten aus einer JSON-Datei.
:param filename: Der Dateiname oder Pfad der zu ladenden Datei. :return: Die geladenen Daten.
Source code in toolboxv2/mods/DB/local_instance.py
137 138 139 140 141 142 143 144 145 146 147 148 | |
save_to_json(data, filename)
¶
Speichert die übergebenen Daten in einer JSON-Datei.
:param data: Die zu speichernden Daten. :param filename: Der Dateiname oder Pfad, in dem die Daten gespeichert werden sollen.
Source code in toolboxv2/mods/DB/local_instance.py
123 124 125 126 127 128 129 130 131 132 133 134 | |
reddis_instance
¶
sync_redis_databases(source_url, target_url)
¶
Synchronize keys from the source Redis database to the target Redis database. This function scans all keys in the source DB and uses DUMP/RESTORE to replicate data to the target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_url
|
str
|
The Redis URL of the source database. |
required |
target_url
|
str
|
The Redis URL of the target database. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
The number of keys successfully synchronized. |
Source code in toolboxv2/mods/DB/reddis_instance.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
tb_adapter
¶
DB
¶
Bases: ABC
Source code in toolboxv2/mods/DB/tb_adapter.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
append_on_set(query, value)
abstractmethod
¶
append set data
Source code in toolboxv2/mods/DB/tb_adapter.py
64 65 66 | |
delete(query, matching=False)
abstractmethod
¶
delete data
Source code in toolboxv2/mods/DB/tb_adapter.py
68 69 70 | |
exit()
abstractmethod
¶
Close DB connection and optional save data
Source code in toolboxv2/mods/DB/tb_adapter.py
76 77 78 | |
get(query)
abstractmethod
¶
get data
Source code in toolboxv2/mods/DB/tb_adapter.py
56 57 58 | |
if_exist(query)
abstractmethod
¶
return True if query exists
Source code in toolboxv2/mods/DB/tb_adapter.py
72 73 74 | |
set(query, value)
abstractmethod
¶
set data
Source code in toolboxv2/mods/DB/tb_adapter.py
60 61 62 | |
ui
¶
api_change_mode(self, request)
async
¶
Changes the database mode from a JSON POST body.
Source code in toolboxv2/mods/DB/ui.py
266 267 268 269 270 271 272 273 | |
api_delete_key(self, request)
async
¶
Deletes a key from a JSON POST body.
Source code in toolboxv2/mods/DB/ui.py
254 255 256 257 258 259 260 261 262 263 | |
api_get_all_keys(self, request)
async
¶
Returns a list of all keys in the database.
Source code in toolboxv2/mods/DB/ui.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
api_get_blob_status(self, request)
async
¶
Returns blob storage status - admin/trusted only.
Source code in toolboxv2/mods/DB/ui.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
api_get_cluster_status(self, request)
async
¶
Get DB cluster status - admin/trusted only.
Source code in toolboxv2/mods/DB/ui.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
api_get_status(self, request)
async
¶
Returns the current status of the DB manager.
Source code in toolboxv2/mods/DB/ui.py
195 196 197 198 | |
api_get_value(self, request, key)
async
¶
Gets a value for a key and returns it as JSON-friendly text.
Source code in toolboxv2/mods/DB/ui.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
api_list_blob_files(self, request)
async
¶
List blob files - admin/trusted only.
Source code in toolboxv2/mods/DB/ui.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
api_manage_cluster(self, request)
async
¶
Manage cluster instances - admin/trusted only.
Source code in toolboxv2/mods/DB/ui.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
api_set_value(self, request)
async
¶
Sets a key-value pair from a JSON POST body.
Source code in toolboxv2/mods/DB/ui.py
241 242 243 244 245 246 247 248 249 250 251 | |
db_manager_ui(**kwargs)
¶
Serves the refactored, JSON-focused UI for the DB Manager.
Source code in toolboxv2/mods/DB/ui.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | |
EventManager
¶
module
¶
EventManagerClass
¶
Source code in toolboxv2/mods/EventManager/module.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | |
trigger_event(event_id)
async
¶
Exec source based on
source_types F -> call directly R -> use get_app(str(event_id)).run_any(args, *kwargs) S -> evaluate string scope instance -> _trigger_local local -> if you ar proxy app run the event through get_app(str(event_id)).run_any(TBEF.EventManager._trigger_local, args=args, kwargs=kwargs, get_result=True) local_network -> use proxy0 app to communicate withe Daemon0 then local global_network -> exec_in event_id threaded
Source code in toolboxv2/mods/EventManager/module.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | |
Rout
dataclass
¶
Source code in toolboxv2/mods/EventManager/module.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
close()
¶
Close
Source code in toolboxv2/mods/EventManager/module.py
165 166 | |
FileWidget
¶
FileUploadHandler
¶
Source code in toolboxv2/mods/FileWidget.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
save_file(chunk_info, storage)
¶
Speichert die Datei oder Chunk. Chunks werden lokal gespeichert, dann zu BlobStorage gemerged.
Source code in toolboxv2/mods/FileWidget.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
access_shared_file(self, request, share_id, filename=None, row=None)
async
¶
Accesses a shared file via its share_id. The URL for this would be like /api/FileWidget/shared/{share_id_value} The 'share_id: str' in signature implies ToolBoxV2 extracts it from path.
Source code in toolboxv2/mods/FileWidget.py
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | |
get_main_ui(self)
async
¶
Serves the main HTML UI for the FileWidget.
Source code in toolboxv2/mods/FileWidget.py
598 599 600 601 602 | |
handle_upload(self, request, form_data=None)
async
¶
Handles file uploads. Expects chunked data via form_data kwarg from Rust server. 'form_data' structure (from Rust's parsing of multipart) after client sends FormData with fields: 'file' (the blob), 'fileName', 'chunkIndex', 'totalChunks'.
Expected form_data in this Python function:
{
"file": { // This 'file' key is the NAME of the form field that held the file blob
"filename": "original_file_name_for_this_chunk.txt", // from Content-Disposition of the 'file' field part
"content_type": "mime/type_of_chunk",
"content_base64": "BASE64_ENCODED_CHUNK_CONTENT"
},
"fileName": "overall_final_filename.txt", // From a separate form field named 'fileName'
"chunkIndex": "0", // From a separate form field named 'chunkIndex'
"totalChunks": "5" // From a separate form field named 'totalChunks'
}
Source code in toolboxv2/mods/FileWidget.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | |
KernelCOOS
¶
kernelcoos
¶
KernelCOOS - Co-OS Kernel Web Interface¶
Complete implementation based on coos.py specification with: - Full WebSocket-based communication (Toolbox Websockets) - Voice-to-Voice support with VAD (Voice Activity Detection) - Wake Word Activation - Real-time chat interface - Session management & configuration - Memory store (JSONL backend) - Task scheduler - Signal bus with priority handling - Learning engine integration
Version: 1.0.0 Author: Co-OS Team
COOSSignal
dataclass
¶
Signal structure for COOS kernel
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
113 114 115 116 117 118 119 120 121 122 123 124 125 | |
COOSSignalType
¶
Bases: Enum
Extended signal types for COOS
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
COOSWebKernel
¶
Complete COOS Web Kernel with voice support
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | |
get_or_create_session(session_id, user_data=None)
¶
Get or create session configuration
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | |
handle_connect(conn_id, session_data)
async
¶
Handle WebSocket connection
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | |
handle_disconnect(conn_id, session_data=None)
async
¶
Handle WebSocket disconnection
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | |
handle_message(conn_id, session_data, payload)
async
¶
Handle incoming WebSocket message
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | |
start()
async
¶
Start the kernel
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | |
stop()
async
¶
Stop the kernel
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
787 788 789 790 791 792 793 794 795 796 797 798 | |
update_session_config(session_id, config_updates)
¶
Update session configuration
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | |
COOSWebSocketRouter
¶
Bases: IOutputRouter
WebSocket-based output router for COOS kernel
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
broadcast(content, event_type='broadcast', exclude_user=None)
async
¶
Broadcast to all connections
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
661 662 663 664 665 666 667 668 669 670 671 672 673 | |
register_connection(conn_id, session)
¶
Register a new WebSocket connection
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
510 511 512 513 514 515 516 517 518 519 520 521 | |
send_error(user_id, error, metadata=None)
async
¶
Send error to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
597 598 599 600 601 602 603 604 605 606 607 608 | |
send_intermediate(user_id, content, stage='processing')
async
¶
Send intermediate response during processing
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
610 611 612 613 614 615 616 617 618 619 620 621 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶
Send notification to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶
Send agent response to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
send_transcription(user_id, text, is_final=True)
async
¶
Send transcription result to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
648 649 650 651 652 653 654 655 656 657 658 659 | |
send_vad_event(user_id, event_type, metadata=None)
async
¶
Send VAD event to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
623 624 625 626 627 628 629 630 631 632 633 | |
send_wake_word_event(user_id, wake_word, activated)
async
¶
Send wake word event to user
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
635 636 637 638 639 640 641 642 643 644 645 646 | |
set_tts_service(tts_service)
¶
Set TTS service for voice responses
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
506 507 508 | |
unregister_connection(conn_id)
¶
Unregister a WebSocket connection
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
523 524 525 526 527 528 529 530 | |
SessionConfig
¶
Bases: BaseModel
Complete session configuration
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
144 145 146 147 148 149 150 151 152 153 154 155 | |
TTSService
¶
Text-to-Speech service
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
synthesize(text, voice='alloy')
async
¶
Synthesize text to speech audio
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
Tools
¶
Bases: MainTool
DirCut Module Tools
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
on_exit()
¶
Cleanup beim Beenden
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1164 1165 1166 | |
show_version()
¶
Zeigt Version
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1168 1169 1170 | |
TranscriptionService
¶
Audio transcription service using Groq or OpenAI
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
transcribe(audio_data, language='de')
async
¶
Transcribe audio data to text
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
VADProcessor
¶
Voice Activity Detection processor
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
calculate_rms(audio_data)
¶
Calculate RMS (Root Mean Square) of audio data
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
get_audio_buffer()
¶
Get the accumulated audio buffer and clear it
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
249 250 251 252 253 254 255 256 | |
process_audio_chunk(audio_data)
¶
Process audio chunk and detect voice activity
Returns:
| Type | Description |
|---|---|
bool
|
Tuple of (is_speech_detected, event_type) |
Optional[str]
|
event_type can be: "speech_start", "speech_end", or None |
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
reset()
¶
Reset VAD state
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
258 259 260 261 262 263 264 | |
VoiceConfig
¶
Bases: BaseModel
Voice configuration for a session
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
130 131 132 133 134 135 136 137 138 139 140 141 | |
WakeWordDetector
¶
Simple wake word detection using transcription
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
check_wake_word(transcription)
¶
Check if transcription contains a wake word
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[str]]
|
Tuple of (wake_word_detected, matched_wake_word) |
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
deactivate()
¶
Manually deactivate wake word
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
310 311 312 313 | |
is_active()
¶
Check if wake word is currently active
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
298 299 300 301 302 303 304 305 306 307 308 | |
reset_timeout()
¶
Reset the activation timeout
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
315 316 317 318 | |
get_kernel_status(app)
async
¶
Get COOS kernel status
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | |
get_kernel_ui(app)
¶
Deliver the COOS Kernel Web UI
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | |
handle_config(app, request=None)
async
¶
Get or update session configuration
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | |
init_kernel_coos(app=None)
¶
Initialize the COOS Kernel module
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | |
register_kernel_handlers(app)
¶
Register WebSocket handlers for COOS kernel
Source code in toolboxv2/mods/KernelCOOS/kernelcoos.py
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | |
Minu
¶
Minu UI Framework - Enhanced Toolbox Module Integration¶
Complete SSR support with Toolbox integration
Component
dataclass
¶
Base component class representing a UI element.
All components serialize to JSON for transport to the frontend.
Source code in toolboxv2/mods/Minu/core.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
to_dict()
¶
Serialize component to JSON-compatible dict
Source code in toolboxv2/mods/Minu/core.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
ComponentStyle
dataclass
¶
CSS-like styling for components
Source code in toolboxv2/mods/Minu/core.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
from_str(css_string)
classmethod
¶
Parse CSS string into ComponentStyle.
Examples:
"margin: 10px; padding: 5px; background: red;" "width: 100%; height: auto; display: flex; gap: 1rem;"
Source code in toolboxv2/mods/Minu/core.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
ComponentType
¶
Bases: str, Enum
All supported component types
Source code in toolboxv2/mods/Minu/core.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
Dynamic
¶
Bases: Component
A container that re-renders its content on the server when bound state changes. Allows for true branching logic (if/else) in the UI.
Source code in toolboxv2/mods/Minu/core.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
MinuSession
¶
Source code in toolboxv2/mods/Minu/core.py
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
force_flush()
async
¶
Immediately send all pending updates. Must be awaited at the end of every event handler.
Source code in toolboxv2/mods/Minu/core.py
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
handle_event(event_data, request=None, app=None)
async
¶
Handle an event from the client with improved callback lookup.
Source code in toolboxv2/mods/Minu/core.py
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
MinuView
¶
Base class for Minu UI views with integrated User and Shared support.
Features: - Reactive state management - User property (authenticated or anonymous) - Shared sections for multi-user collaboration
Usage
class MyDashboard(MinuView): title = State("Dashboard")
def render(self):
# User ist automatisch verfügbar
if self.user.is_authenticated:
greeting = f"Willkommen, {self.user.name}!"
else:
greeting = "Willkommen, Gast!"
return Column(
Heading(self.title.value),
Text(greeting),
Button("Click me", on_click="handle_click")
)
async def handle_click(self, event):
# User-Daten speichern
if self.user.is_authenticated:
await self.user.set_mod_data('MyMod', {'clicked': True})
else:
self.user.set_mod_data('MyMod', {'clicked': True})
Multi-User Example
class GameLobby(MinuView): async def on_mount(self): # Shared Section erstellen oder beitreten self.game = await self.create_shared( name="game_123", initial_data={'players': [], 'state': 'waiting'} )
# Auf Änderungen reagieren
self.game.on_change('state', self.on_game_state_change)
async def on_join(self, event):
await self.game.append('players', {
'id': self.user.uid,
'name': self.user.name,
'score': 0
})
Source code in toolboxv2/mods/Minu/core.py
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
shared_manager
property
¶
SharedManager Instanz
user
property
¶
Aktueller User (angemeldet oder anonym).
Für angemeldete Nutzer
- user.name, user.uid, user.email, etc.
- user.get_mod_client('ModName') für ModDataClient
- await user.get_mod_data('ModName')
- await user.set_mod_data('ModName', {...})
Für anonyme Nutzer
- user.name == "anonymous"
- user.level == -1
- user.uid == "anon_
" - user.get_mod_data('ModName') (synchron, Session-basiert)
- user.set_mod_data('ModName', {...}) (synchron, Session-basiert)
__getattr__(name)
¶
Fallback für dynamisch registrierte Callback-Handler. Sucht in der lokalen _callback_registry wenn vorhanden.
Source code in toolboxv2/mods/Minu/core.py
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
create_shared(name, initial_data=None, **kwargs)
async
¶
Neue Shared Section erstellen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name der Section |
required |
initial_data
|
Dict[str, Any]
|
Initiale Daten |
None
|
**kwargs
|
Weitere Optionen (max_participants, allow_anonymous, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
SharedSection
|
SharedSection Instanz |
Source code in toolboxv2/mods/Minu/core.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | |
ensure_user()
async
¶
Async User-Laden. Sollte zu Beginn eines Event-Handlers aufgerufen werden.
Usage
async def on_submit(self, event): user = await self.ensure_user() if user.is_authenticated: await user.set_mod_data('MyMod', {'score': 100})
Source code in toolboxv2/mods/Minu/core.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | |
get_shared(section_id)
¶
Lokale Shared Section abrufen
Source code in toolboxv2/mods/Minu/core.py
1240 1241 1242 | |
join_shared(section_id)
async
¶
Shared Section beitreten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_id
|
str
|
ID der Section |
required |
Returns:
| Type | Description |
|---|---|
SharedSection | None
|
SharedSection oder None wenn nicht erlaubt |
Source code in toolboxv2/mods/Minu/core.py
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | |
leave_shared(section_id)
async
¶
Shared Section verlassen
Source code in toolboxv2/mods/Minu/core.py
1231 1232 1233 1234 1235 1236 1237 1238 | |
register_dynamic(dyn)
¶
Helper to register dynamic components during render
Source code in toolboxv2/mods/Minu/core.py
1279 1280 1281 | |
set_app(app)
¶
App-Referenz setzen (wird von Session-Handler aufgerufen)
Source code in toolboxv2/mods/Minu/core.py
1176 1177 1178 | |
to_dict()
¶
Serialize view to dict, setting context for callback registration.
Source code in toolboxv2/mods/Minu/core.py
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | |
ReactiveState
¶
Bases: Generic[T]
A reactive state container that tracks changes and notifies observers.
Usage
name = ReactiveState("initial") name.value = "changed" # Triggers observers
Source code in toolboxv2/mods/Minu/core.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
bind(observer)
¶
Bind this state to a view for automatic updates
Source code in toolboxv2/mods/Minu/core.py
117 118 119 | |
Alert(message, variant='info', title=None, dismissible=False, on_dismiss=None, **props)
¶
Alert/notification component
Source code in toolboxv2/mods/Minu/core.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
Badge(text, variant='default', className=None)
¶
Small badge/tag component
Source code in toolboxv2/mods/Minu/core.py
901 902 903 904 905 906 907 908 909 910 911 | |
Button(label, on_click=None, variant='primary', disabled=False, icon=None, className=None, **props)
¶
Interactive button component.
Usage
Button("Save", on_click="handle_save", variant="primary")
Source code in toolboxv2/mods/Minu/core.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
Card(*children, title=None, subtitle=None, className='card', style=None, **props)
¶
A card container with optional header.
Usage
Card( Text("Content"), title="My Card", className="card animate-fade-in" )
Source code in toolboxv2/mods/Minu/core.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
Checkbox(label, checked=False, bind=None, on_change=None, **props)
¶
Checkbox input with label
Source code in toolboxv2/mods/Minu/core.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
Column(*children, gap='4', align='stretch', className=None, **props)
¶
Vertical flex container
Source code in toolboxv2/mods/Minu/core.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
Custom(html='', component_name=None, **props)
¶
Custom HTML or registered component.
Usage
Custom(html="
Source code in toolboxv2/mods/Minu/core.py
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | |
Divider(className=None, **props)
¶
Horizontal divider line
Source code in toolboxv2/mods/Minu/core.py
744 745 746 747 748 749 750 | |
Form(*children, on_submit=None, className=None, **props)
¶
Form container with submit handling
Source code in toolboxv2/mods/Minu/core.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | |
Grid(*children, cols=2, gap='4', className=None, **props)
¶
CSS Grid container
Source code in toolboxv2/mods/Minu/core.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
Heading(text, level=1, className=None, **props)
¶
Heading component (h1-h6)
Source code in toolboxv2/mods/Minu/core.py
449 450 451 452 453 454 455 456 457 458 | |
Icon(name, size='24', className=None)
¶
Material icon component
Source code in toolboxv2/mods/Minu/core.py
876 877 878 879 880 881 882 | |
Image(src, alt='', width=None, height=None, className=None, **props)
¶
Image component
Source code in toolboxv2/mods/Minu/core.py
885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
Input(placeholder='', value='', input_type='text', bind=None, on_change=None, on_submit=None, label=None, className=None, **props)
¶
Text input component with optional label and bindings.
Usage
Input( placeholder="Enter name", bind="user.name", on_change="validate_name" )
Source code in toolboxv2/mods/Minu/core.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
List(*items, ordered=False, className=None, **props)
¶
List component
Source code in toolboxv2/mods/Minu/core.py
843 844 845 846 847 848 849 850 851 852 | |
ListItem(*children, on_click=None, className=None, **props)
¶
List item component
Source code in toolboxv2/mods/Minu/core.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |
Modal(*children, title=None, open=False, bind_open=None, on_close=None, **props)
¶
Modal dialog component
Source code in toolboxv2/mods/Minu/core.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | |
Progress(value=0, max_value=100, label=None, bind=None, **props)
¶
Progress bar component
Source code in toolboxv2/mods/Minu/core.py
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | |
Row(*children, gap='4', align='center', justify='start', wrap=False, className=None, **props)
¶
Horizontal flex container
Source code in toolboxv2/mods/Minu/core.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
Select(options, value='', placeholder='Select...', bind=None, on_change=None, label=None, **props)
¶
Dropdown select component.
Usage
Select( options=[ {"value": "opt1", "label": "Option 1"}, {"value": "opt2", "label": "Option 2"} ], bind="selected_option" )
Source code in toolboxv2/mods/Minu/core.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | |
Spacer(size='4', **props)
¶
Empty space component
Source code in toolboxv2/mods/Minu/core.py
739 740 741 | |
Spinner(size='md', className=None)
¶
Loading spinner
Source code in toolboxv2/mods/Minu/core.py
798 799 800 801 802 803 804 | |
State(initial, path='')
¶
Factory function for creating reactive state
Source code in toolboxv2/mods/Minu/core.py
125 126 127 | |
Switch(label='', checked=False, bind=None, on_change=None, **props)
¶
Toggle switch component
Source code in toolboxv2/mods/Minu/core.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
Table(columns, data, bind_data=None, on_row_click=None, **props)
¶
Data table component.
Usage
Table( columns=[ {"key": "name", "label": "Name"}, {"key": "email", "label": "Email"} ], data=[ {"name": "John", "email": "john@example.com"} ], bind_data="users" )
Source code in toolboxv2/mods/Minu/core.py
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
Tabs(tabs, active=0, bind_active=None, on_change=None, **props)
¶
Tab navigation component.
Usage
Tabs( tabs=[ {"label": "Tab 1", "content": Card(Text("Content 1"))}, {"label": "Tab 2", "content": Card(Text("Content 2"))} ], bind_active="active_tab" )
Source code in toolboxv2/mods/Minu/core.py
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | |
Text(content, variant='body', className=None, bind=None, **props)
¶
Simple text component
Source code in toolboxv2/mods/Minu/core.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
Textarea(placeholder='', value='', bind=None, on_change=None, on_submit=None, label=None, rows=None, className=None, **props)
¶
Multiline textarea component with optional label, bindings and events.
Usage
Textarea( placeholder="Enter description", bind="user.bio", rows=4, on_change="handle_bio_change" )
Source code in toolboxv2/mods/Minu/core.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
Widget(*children, title='', collapsible=False, className=None, **props)
¶
Floating widget container (uses .widget CSS class)
Source code in toolboxv2/mods/Minu/core.py
935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
cleanup_session(session_id)
¶
Remove a session
Source code in toolboxv2/mods/Minu/__init__.py
87 88 89 90 | |
flow_ui_meta(title=None, description=None, icon=None, auth=False, bg_img_url=None)
¶
Decorator to add metadata to a flow UI function.
Usage in your flow file
@flow_ui_meta(title="My Cool App", icon="rocket", auth=True) def ui(view): return Column(...)
Source code in toolboxv2/mods/Minu/__init__.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
get_or_create_session(session_id)
¶
Get existing session or create new one
Source code in toolboxv2/mods/Minu/__init__.py
80 81 82 83 84 | |
get_view_class(name)
¶
Get a registered view class by name
Source code in toolboxv2/mods/Minu/__init__.py
70 71 72 | |
handle_event(app, request, session_id, view_id, handler, payload=None)
async
¶
Handle a UI event from the frontend.
POST /api/Minu/event { "session_id": "...", "view_id": "...", "handler": "button_clicked", "payload": {...} }
Source code in toolboxv2/mods/Minu/__init__.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
list_flows(app, request, only_custom_ui=True, **kwargs)
async
¶
List all available flows for the dashboard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
only_custom_ui
|
bool
|
If True, only return flows with custom UI (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
Result
|
List of flow info objects with name, title, description, icon, path, auth |
GET /api/Minu/list_flows GET /api/Minu/list_flows?only_custom_ui=false
Source code in toolboxv2/mods/Minu/__init__.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
list_registered_views(app)
async
¶
List all registered view classes.
GET /api/Minu/list_views
Source code in toolboxv2/mods/Minu/__init__.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | |
register_view(name, view_class)
¶
Register a view class for later instantiation.
Usage in your module
from minu import register_view
class MyDashboard(MinuView): ...
register_view("my_dashboard", MyDashboard)
Source code in toolboxv2/mods/Minu/__init__.py
55 56 57 58 59 60 61 62 63 64 65 66 67 | |
render_view(app, request, view=None, props=None, ssr=None, format='auto', **kwargs)
async
¶
Enhanced render endpoint with full SSR support.
Modes: - JSON (default): Returns view definition for client-side rendering - SSR HTML: Returns pre-rendered HTML fragment - Full HTML: Returns complete HTML document
GET /api/Minu/render?view=my_dashboard&ssr=true&format=full-html POST /api/Minu/render {"view": "my_dashboard", "props": {...}, "ssr": "true"}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
str
|
View name to render |
None
|
props
|
Optional[Dict[str, Any]]
|
Optional props for the view |
None
|
ssr
|
Optional[str]
|
Enable server-side rendering ("true", "1", or any truthy value) |
None
|
format
|
str
|
Output format ("auto", "json", "html", "full-html") - auto: JSON for API calls, full-html for browser requests - json: Always return JSON (for AJAX) - html: Return HTML fragment only - full-html: Return complete HTML document |
'auto'
|
Returns:
| Type | Description |
|---|---|
Result
|
Result object with rendered content |
Source code in toolboxv2/mods/Minu/__init__.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
stream_updates(app, request, view_name, props=None)
async
¶
SSE endpoint for real-time UI updates.
GET /api/Minu/stream?view_name=dashboard&props={"key":"value"}
Source code in toolboxv2/mods/Minu/__init__.py
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | |
sync_flow_uis(app)
async
¶
Scans all available Toolbox Flows and registers UI views for them.
GET /api/Minu/sync_flows
Source code in toolboxv2/mods/Minu/__init__.py
316 317 318 319 320 321 322 323 324 325 326 327 | |
update_state(app, request, session_id, view_id, path, value)
async
¶
Update view state from the frontend (two-way binding).
POST /api/Minu/state { "session_id": "...", "view_id": "...", "path": "name", "value": "New Value" }
Source code in toolboxv2/mods/Minu/__init__.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
core
¶
Minu UI Framework for Toolbox V2¶
A lightweight, reactive UI framework that generates JSON-based UI definitions and sends them via WebSocket for real-time rendering in TBJS.
Design Principles: 1. Simple Python API - UI als Python-Objekte 2. Reactive State - Automatische Updates bei Änderungen 3. Minimal Payloads - Nur Diffs werden gesendet 4. Native Toolbox - Volle Integration mit Result, Export, etc.
__all__ = ['State', 'ReactiveState', 'StateChange', 'Component', 'ComponentType', 'ComponentStyle', 'Card', 'Text', 'Heading', 'Button', 'Input', 'Select', 'Checkbox', 'Switch', 'Row', 'Column', 'Grid', 'Spacer', 'Divider', 'Alert', 'Progress', 'Spinner', 'Table', 'List', 'ListItem', 'Icon', 'Image', 'Badge', 'Modal', 'Widget', 'Form', 'Tabs', 'Custom', 'MinuView', 'MinuSession', 'minu_handler']
module-attribute
¶
Beispiel 1: Einfache View mit User-Zugriff¶
class UserDashboard(MinuView): greeting = State("")
def render(self):
return Column(
Heading("Dashboard"),
Text(self.greeting.value or f"Hallo, {self.user.name}!"),
# Zeige verschiedene Inhalte basierend auf Auth-Status
*self._render_content()
)
def _render_content(self):
if self.user.is_authenticated:
return [
Text(f"Level: {self.user.level}"),
Text(f"Email: {self.user.email}"),
Button("Abmelden", on_click="logout")
]
else:
return [
Text("Du bist nicht angemeldet."),
Button("Anmelden", on_click="login")
]
async def on_mount(self):
# User async laden für vollständige Daten
user = await self.ensure_user()
# Mod-Daten laden
if user.is_authenticated:
data = await user.get_mod_data('Dashboard')
if data.get('last_visit'):
self.greeting.value = f"Willkommen zurück, {user.name}!"
Beispiel 2: Multi-User Chat¶
class ChatRoom(MinuView): messages = State([]) input_text = State("")
async def on_mount(self):
# Shared Section für den Chat-Room
self.chat = await self.join_shared('chat_room_general')
if self.chat:
# Existierende Nachrichten laden
self.messages.value = self.chat.get('messages', [])
# Auf neue Nachrichten reagieren
self.chat.on_change('messages', self._on_new_message)
def _on_new_message(self, change):
# Update UI wenn neue Nachrichten ankommen
if change.operation == 'append':
current = self.messages.value.copy()
current.append(change.value)
self.messages.value = current
def render(self):
return Column(
Heading("Chat Room"),
# Message List
List(*[
ListItem(
Text(f"{msg['author']}: {msg['text']}")
) for msg in self.messages.value
]),
# Input
Row(
Input(
placeholder="Nachricht...",
bind_value="input_text"
),
Button("Senden", on_click="send_message")
)
)
async def send_message(self, event):
text = self.input_text.value.strip()
if not text:
return
# Nachricht an alle Teilnehmer senden
await self.chat.append('messages', {
'author': self.user.name,
'author_id': self.user.uid,
'text': text,
'timestamp': time.time()
}, author_id=self.user.uid)
self.input_text.value = ""
Beispiel 3: Multiplayer Game¶
class GameLobby(MinuView): players = State([]) game_state = State("waiting") # waiting, playing, finished
async def on_mount(self):
# Game Session erstellen oder beitreten
game_id = self.props.get('game_id', 'default_game')
self.game = await self.join_shared(f'game_{game_id}')
if not self.game:
# Neues Spiel erstellen
self.game = await self.create_shared(
name=f'game_{game_id}',
initial_data={
'players': [],
'state': 'waiting',
'scores': {}
},
max_participants=4,
allow_anonymous=True
)
# State synchronisieren
self.players.value = self.game.get('players', [])
self.game_state.value = self.game.get('state', 'waiting')
# Auf Änderungen reagieren
self.game.on_change('players', self._on_players_change)
self.game.on_change('state', self._on_state_change)
# Selbst als Spieler hinzufügen
await self._join_game()
async def _join_game(self):
players = self.game.get('players', [])
# Prüfen ob bereits im Spiel
if any(p['id'] == self.user.uid for p in players):
return
await self.game.append('players', {
'id': self.user.uid,
'name': self.user.name,
'ready': False
}, author_id=self.user.uid)
def _on_players_change(self, change):
self.players.value = self.game.get('players', [])
def _on_state_change(self, change):
self.game_state.value = change.value
def render(self):
return Column(
Heading(f"Game Lobby ({self.game_state.value})"),
# Spielerliste
Card(
Heading("Spieler", level=3),
List(*[
ListItem(
Row(
Text(p['name']),
Badge("Bereit" if p.get('ready') else "Wartet",
variant="success" if p.get('ready') else "default")
)
) for p in self.players.value
])
),
# Aktionen
Row(
Button("Bereit", on_click="toggle_ready",
variant="primary" if not self._am_ready() else "default"),
Button("Spiel starten", on_click="start_game",
disabled=not self._can_start())
) if self.game_state.value == "waiting" else None
)
def _am_ready(self) -> bool:
for p in self.players.value:
if p['id'] == self.user.uid:
return p.get('ready', False)
return False
def _can_start(self) -> bool:
if len(self.players.value) < 2:
return False
return all(p.get('ready') for p in self.players.value)
async def toggle_ready(self, event):
players = self.game.get('players', [])
for i, p in enumerate(players):
if p['id'] == self.user.uid:
players[i]['ready'] = not p.get('ready', False)
await self.game.set('players', players, author_id=self.user.uid)
break
async def start_game(self, event):
if self._can_start():
await self.game.set('state', 'playing', author_id=self.user.uid)
Component
dataclass
¶
Base component class representing a UI element.
All components serialize to JSON for transport to the frontend.
Source code in toolboxv2/mods/Minu/core.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
to_dict()
¶
Serialize component to JSON-compatible dict
Source code in toolboxv2/mods/Minu/core.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
ComponentStyle
dataclass
¶
CSS-like styling for components
Source code in toolboxv2/mods/Minu/core.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
from_str(css_string)
classmethod
¶
Parse CSS string into ComponentStyle.
Examples:
"margin: 10px; padding: 5px; background: red;" "width: 100%; height: auto; display: flex; gap: 1rem;"
Source code in toolboxv2/mods/Minu/core.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
ComponentType
¶
Bases: str, Enum
All supported component types
Source code in toolboxv2/mods/Minu/core.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
Dynamic
¶
Bases: Component
A container that re-renders its content on the server when bound state changes. Allows for true branching logic (if/else) in the UI.
Source code in toolboxv2/mods/Minu/core.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
MinuJSONEncoder
¶
Bases: JSONEncoder
Automatische Umwandlung von ReactiveState in den eigentlichen Wert. Verhindert Fehler, wenn man aus Versehen 'self.state' statt 'self.state.value' übergibt.
Source code in toolboxv2/mods/Minu/core.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
MinuSession
¶
Source code in toolboxv2/mods/Minu/core.py
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
force_flush()
async
¶
Immediately send all pending updates. Must be awaited at the end of every event handler.
Source code in toolboxv2/mods/Minu/core.py
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
handle_event(event_data, request=None, app=None)
async
¶
Handle an event from the client with improved callback lookup.
Source code in toolboxv2/mods/Minu/core.py
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
MinuView
¶
Base class for Minu UI views with integrated User and Shared support.
Features: - Reactive state management - User property (authenticated or anonymous) - Shared sections for multi-user collaboration
Usage
class MyDashboard(MinuView): title = State("Dashboard")
def render(self):
# User ist automatisch verfügbar
if self.user.is_authenticated:
greeting = f"Willkommen, {self.user.name}!"
else:
greeting = "Willkommen, Gast!"
return Column(
Heading(self.title.value),
Text(greeting),
Button("Click me", on_click="handle_click")
)
async def handle_click(self, event):
# User-Daten speichern
if self.user.is_authenticated:
await self.user.set_mod_data('MyMod', {'clicked': True})
else:
self.user.set_mod_data('MyMod', {'clicked': True})
Multi-User Example
class GameLobby(MinuView): async def on_mount(self): # Shared Section erstellen oder beitreten self.game = await self.create_shared( name="game_123", initial_data={'players': [], 'state': 'waiting'} )
# Auf Änderungen reagieren
self.game.on_change('state', self.on_game_state_change)
async def on_join(self, event):
await self.game.append('players', {
'id': self.user.uid,
'name': self.user.name,
'score': 0
})
Source code in toolboxv2/mods/Minu/core.py
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
shared_manager
property
¶
SharedManager Instanz
user
property
¶
Aktueller User (angemeldet oder anonym).
Für angemeldete Nutzer
- user.name, user.uid, user.email, etc.
- user.get_mod_client('ModName') für ModDataClient
- await user.get_mod_data('ModName')
- await user.set_mod_data('ModName', {...})
Für anonyme Nutzer
- user.name == "anonymous"
- user.level == -1
- user.uid == "anon_
" - user.get_mod_data('ModName') (synchron, Session-basiert)
- user.set_mod_data('ModName', {...}) (synchron, Session-basiert)
__getattr__(name)
¶
Fallback für dynamisch registrierte Callback-Handler. Sucht in der lokalen _callback_registry wenn vorhanden.
Source code in toolboxv2/mods/Minu/core.py
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
create_shared(name, initial_data=None, **kwargs)
async
¶
Neue Shared Section erstellen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name der Section |
required |
initial_data
|
Dict[str, Any]
|
Initiale Daten |
None
|
**kwargs
|
Weitere Optionen (max_participants, allow_anonymous, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
SharedSection
|
SharedSection Instanz |
Source code in toolboxv2/mods/Minu/core.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | |
ensure_user()
async
¶
Async User-Laden. Sollte zu Beginn eines Event-Handlers aufgerufen werden.
Usage
async def on_submit(self, event): user = await self.ensure_user() if user.is_authenticated: await user.set_mod_data('MyMod', {'score': 100})
Source code in toolboxv2/mods/Minu/core.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | |
get_shared(section_id)
¶
Lokale Shared Section abrufen
Source code in toolboxv2/mods/Minu/core.py
1240 1241 1242 | |
join_shared(section_id)
async
¶
Shared Section beitreten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_id
|
str
|
ID der Section |
required |
Returns:
| Type | Description |
|---|---|
SharedSection | None
|
SharedSection oder None wenn nicht erlaubt |
Source code in toolboxv2/mods/Minu/core.py
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | |
leave_shared(section_id)
async
¶
Shared Section verlassen
Source code in toolboxv2/mods/Minu/core.py
1231 1232 1233 1234 1235 1236 1237 1238 | |
register_dynamic(dyn)
¶
Helper to register dynamic components during render
Source code in toolboxv2/mods/Minu/core.py
1279 1280 1281 | |
set_app(app)
¶
App-Referenz setzen (wird von Session-Handler aufgerufen)
Source code in toolboxv2/mods/Minu/core.py
1176 1177 1178 | |
to_dict()
¶
Serialize view to dict, setting context for callback registration.
Source code in toolboxv2/mods/Minu/core.py
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | |
ReactiveState
¶
Bases: Generic[T]
A reactive state container that tracks changes and notifies observers.
Usage
name = ReactiveState("initial") name.value = "changed" # Triggers observers
Source code in toolboxv2/mods/Minu/core.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
bind(observer)
¶
Bind this state to a view for automatic updates
Source code in toolboxv2/mods/Minu/core.py
117 118 119 | |
StateChange
¶
Represents a single state change for diffing
Source code in toolboxv2/mods/Minu/core.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
Alert(message, variant='info', title=None, dismissible=False, on_dismiss=None, **props)
¶
Alert/notification component
Source code in toolboxv2/mods/Minu/core.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
Badge(text, variant='default', className=None)
¶
Small badge/tag component
Source code in toolboxv2/mods/Minu/core.py
901 902 903 904 905 906 907 908 909 910 911 | |
Button(label, on_click=None, variant='primary', disabled=False, icon=None, className=None, **props)
¶
Interactive button component.
Usage
Button("Save", on_click="handle_save", variant="primary")
Source code in toolboxv2/mods/Minu/core.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
Card(*children, title=None, subtitle=None, className='card', style=None, **props)
¶
A card container with optional header.
Usage
Card( Text("Content"), title="My Card", className="card animate-fade-in" )
Source code in toolboxv2/mods/Minu/core.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
Checkbox(label, checked=False, bind=None, on_change=None, **props)
¶
Checkbox input with label
Source code in toolboxv2/mods/Minu/core.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
Column(*children, gap='4', align='stretch', className=None, **props)
¶
Vertical flex container
Source code in toolboxv2/mods/Minu/core.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
Custom(html='', component_name=None, **props)
¶
Custom HTML or registered component.
Usage
Custom(html="
Source code in toolboxv2/mods/Minu/core.py
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | |
Divider(className=None, **props)
¶
Horizontal divider line
Source code in toolboxv2/mods/Minu/core.py
744 745 746 747 748 749 750 | |
Form(*children, on_submit=None, className=None, **props)
¶
Form container with submit handling
Source code in toolboxv2/mods/Minu/core.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | |
Grid(*children, cols=2, gap='4', className=None, **props)
¶
CSS Grid container
Source code in toolboxv2/mods/Minu/core.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
Heading(text, level=1, className=None, **props)
¶
Heading component (h1-h6)
Source code in toolboxv2/mods/Minu/core.py
449 450 451 452 453 454 455 456 457 458 | |
Icon(name, size='24', className=None)
¶
Material icon component
Source code in toolboxv2/mods/Minu/core.py
876 877 878 879 880 881 882 | |
Image(src, alt='', width=None, height=None, className=None, **props)
¶
Image component
Source code in toolboxv2/mods/Minu/core.py
885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
Input(placeholder='', value='', input_type='text', bind=None, on_change=None, on_submit=None, label=None, className=None, **props)
¶
Text input component with optional label and bindings.
Usage
Input( placeholder="Enter name", bind="user.name", on_change="validate_name" )
Source code in toolboxv2/mods/Minu/core.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
List(*items, ordered=False, className=None, **props)
¶
List component
Source code in toolboxv2/mods/Minu/core.py
843 844 845 846 847 848 849 850 851 852 | |
ListItem(*children, on_click=None, className=None, **props)
¶
List item component
Source code in toolboxv2/mods/Minu/core.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |
Modal(*children, title=None, open=False, bind_open=None, on_close=None, **props)
¶
Modal dialog component
Source code in toolboxv2/mods/Minu/core.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | |
Progress(value=0, max_value=100, label=None, bind=None, **props)
¶
Progress bar component
Source code in toolboxv2/mods/Minu/core.py
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | |
Row(*children, gap='4', align='center', justify='start', wrap=False, className=None, **props)
¶
Horizontal flex container
Source code in toolboxv2/mods/Minu/core.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
Select(options, value='', placeholder='Select...', bind=None, on_change=None, label=None, **props)
¶
Dropdown select component.
Usage
Select( options=[ {"value": "opt1", "label": "Option 1"}, {"value": "opt2", "label": "Option 2"} ], bind="selected_option" )
Source code in toolboxv2/mods/Minu/core.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | |
Spacer(size='4', **props)
¶
Empty space component
Source code in toolboxv2/mods/Minu/core.py
739 740 741 | |
Spinner(size='md', className=None)
¶
Loading spinner
Source code in toolboxv2/mods/Minu/core.py
798 799 800 801 802 803 804 | |
State(initial, path='')
¶
Factory function for creating reactive state
Source code in toolboxv2/mods/Minu/core.py
125 126 127 | |
Switch(label='', checked=False, bind=None, on_change=None, **props)
¶
Toggle switch component
Source code in toolboxv2/mods/Minu/core.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
Table(columns, data, bind_data=None, on_row_click=None, **props)
¶
Data table component.
Usage
Table( columns=[ {"key": "name", "label": "Name"}, {"key": "email", "label": "Email"} ], data=[ {"name": "John", "email": "john@example.com"} ], bind_data="users" )
Source code in toolboxv2/mods/Minu/core.py
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
Tabs(tabs, active=0, bind_active=None, on_change=None, **props)
¶
Tab navigation component.
Usage
Tabs( tabs=[ {"label": "Tab 1", "content": Card(Text("Content 1"))}, {"label": "Tab 2", "content": Card(Text("Content 2"))} ], bind_active="active_tab" )
Source code in toolboxv2/mods/Minu/core.py
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | |
Text(content, variant='body', className=None, bind=None, **props)
¶
Simple text component
Source code in toolboxv2/mods/Minu/core.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
Textarea(placeholder='', value='', bind=None, on_change=None, on_submit=None, label=None, rows=None, className=None, **props)
¶
Multiline textarea component with optional label, bindings and events.
Usage
Textarea( placeholder="Enter description", bind="user.bio", rows=4, on_change="handle_bio_change" )
Source code in toolboxv2/mods/Minu/core.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
Widget(*children, title='', collapsible=False, className=None, **props)
¶
Floating widget container (uses .widget CSS class)
Source code in toolboxv2/mods/Minu/core.py
935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
minu_handler(view_class)
¶
Decorator to create a Minu UI endpoint from a View class.
Usage
@minu_handler class MyDashboard(MinuView): ...
This creates:¶
- WebSocket handler for live updates¶
- API endpoint for initial render¶
Source code in toolboxv2/mods/Minu/core.py
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | |
examples
¶
Minu UI Framework - Example Module (ÜBERARBEITET)¶
Demonstrates how to create reactive UIs with Minu in Toolbox modules.
CounterView
¶
Bases: MinuView
A simple counter demonstrating reactive state.
Source code in toolboxv2/mods/Minu/examples.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
DataTableView
¶
Bases: MinuView
A data table with sorting and filtering.
Source code in toolboxv2/mods/Minu/examples.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
ProfileFormView
¶
Bases: MinuView
A form demonstrating two-way data binding.
Source code in toolboxv2/mods/Minu/examples.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
get_demo_page(app)
async
¶
Serves the demo page with all examples
Source code in toolboxv2/mods/Minu/examples.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | |
initialize(app, **kwargs)
¶
Initialize module and register all views
Source code in toolboxv2/mods/Minu/examples.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
flow_integration
¶
Minu Flow Integration V3¶
Automatische Generierung von UIs für Toolbox Flows mit stabilem Callback-System.
WICHTIGE ÄNDERUNGEN: - Callbacks werden pro View-Instanz gespeichert, nicht global - Callback-IDs sind stabil (basierend auf Funktionsname, nicht Counter) - State-Updates werden korrekt propagiert - Nur Flows mit Custom UI werden im Dashboard angezeigt
FlowWrapperView
¶
Bases: MinuView
Generischer View-Wrapper für Toolbox-Flows.
Features: - Stabile Callback-IDs - Korrekte State-Propagation - Custom UI Support mit View-Referenz
Source code in toolboxv2/mods/Minu/flow_integration.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
__getattr__(name)
¶
Fallback für dynamische Callback-Handler. Sucht in der lokalen Registry.
Source code in toolboxv2/mods/Minu/flow_integration.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
register_callback(callback, hint='')
¶
Registriert einen Callback und gibt die Handler-ID zurück.
Source code in toolboxv2/mods/Minu/flow_integration.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
render()
¶
Rendert die UI.
Source code in toolboxv2/mods/Minu/flow_integration.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
reset(event)
async
¶
Zurück zum Idle-State.
Source code in toolboxv2/mods/Minu/flow_integration.py
218 219 220 221 222 223 | |
run_flow(event)
async
¶
Handler für Flow-Ausführung.
Source code in toolboxv2/mods/Minu/flow_integration.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
ViewCallbackRegistry
¶
Callback-Registry die an eine View-Instanz gebunden ist. Verwendet stabile IDs basierend auf Funktionsnamen.
Source code in toolboxv2/mods/Minu/flow_integration.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
register(callback, hint='')
¶
Registriert Callback mit stabiler ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
Callable
|
Die Callback-Funktion |
required |
hint
|
str
|
Optionaler Hint für bessere ID-Generierung |
''
|
Returns:
| Type | Description |
|---|---|
str
|
Stabile Handler-ID |
Source code in toolboxv2/mods/Minu/flow_integration.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
render_unified_dashboard(app, user_authenticated=False)
¶
Rendert ein einheitliches Dashboard mit Apps und Flows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Toolbox App-Instanz |
required | |
user_authenticated
|
bool
|
Ob der User eingeloggt ist |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Vollständiges HTML für das Dashboard |
Source code in toolboxv2/mods/Minu/flow_integration.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
scan_and_register_flows(app, only_custom_ui=True)
¶
Scannt Flows und registriert Views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Toolbox App-Instanz |
required | |
only_custom_ui
|
bool
|
Wenn True, nur Flows mit Custom UI anzeigen |
True
|
Returns:
| Type | Description |
|---|---|
str
|
HTML-String des Dashboards |
Source code in toolboxv2/mods/Minu/flow_integration.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | |
flows
¶
Minu UI Framework - Flow Helpers V3¶
Utility functions für UIs mit stabilem Callback-System.
WICHTIG: Callbacks werden jetzt an die View gebunden, nicht global gespeichert.
Die View muss register_callback Methode haben.
CallbackButton(label, on_click=None, variant='primary', disabled=False, icon=None, className=None, **props)
¶
Button mit Python-Callback-Unterstützung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Button-Text |
required |
on_click
|
Union[str, Callable, None]
|
String-Handler ODER Python-Funktion |
None
|
variant
|
str
|
Button-Stil (primary, secondary, ghost) |
'primary'
|
disabled
|
bool
|
Deaktiviert? |
False
|
icon
|
str | None
|
Optional Icon-Name |
None
|
className
|
str | None
|
CSS-Klassen |
None
|
Example
def handle_click(event): print("Clicked!", event)
CallbackButton("Click Me", on_click=handle_click)
Source code in toolboxv2/mods/Minu/flows.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
CallbackCheckbox(label='', checked=False, bind=None, on_change=None, className=None, **props)
¶
Checkbox mit Callback-Unterstützung.
Source code in toolboxv2/mods/Minu/flows.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
CallbackInput(placeholder='', value='', input_type='text', bind=None, on_change=None, on_submit=None, label=None, className=None, **props)
¶
Input mit Callback-Unterstützung.
Source code in toolboxv2/mods/Minu/flows.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
CallbackSelect(options, value='', bind=None, on_change=None, label=None, placeholder='Select...', className=None, **props)
¶
Select mit Callback-Unterstützung.
Source code in toolboxv2/mods/Minu/flows.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
action_bar(actions, title=None)
¶
Action Bar mit Buttons.
Source code in toolboxv2/mods/Minu/flows.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
clear_current_view()
¶
Löscht den View-Context.
Source code in toolboxv2/mods/Minu/flows.py
59 60 61 | |
data_card(data, title=None, actions=None)
¶
Data Card mit Actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Dict[str, Any]
|
Daten-Dict |
required |
title
|
Optional[str]
|
Titel |
None
|
actions
|
Optional[List[Dict[str, Any]]]
|
Liste von {label, handler, variant, icon} |
None
|
Source code in toolboxv2/mods/Minu/flows.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
data_table(data, columns=None, title=None, on_row_click=None)
¶
Data Table mit optionalem Row-Click-Handler.
Source code in toolboxv2/mods/Minu/flows.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
form_for(schema, values=None, on_submit='submit_form', title=None, submit_label='Submit')
¶
Generiert ein Formular aus einem Schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
Dict[str, Dict[str, Any]]
|
Feld-Schema {name: {type, label, default, options, ...}} |
required |
values
|
Optional[Dict[str, Any]]
|
Initiale Werte |
None
|
on_submit
|
Union[str, Callable, None]
|
Submit-Handler |
'submit_form'
|
title
|
Optional[str]
|
Formular-Titel |
None
|
submit_label
|
str
|
Text für Submit-Button |
'Submit'
|
Example
schema = { "name": {"type": "text", "label": "Name"}, "email": {"type": "email", "label": "Email"}, "role": {"type": "select", "options": [{"value": "user", "label": "User"}]} } form_for(schema, on_submit=my_handler)
Source code in toolboxv2/mods/Minu/flows.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
get_current_view()
¶
Holt den aktuellen View-Context.
Source code in toolboxv2/mods/Minu/flows.py
54 55 56 | |
set_current_view(view)
¶
Setzt den aktuellen View-Context für Callback-Registrierung.
Source code in toolboxv2/mods/Minu/flows.py
49 50 51 | |
stats_grid(stats, cols=4)
¶
Stats Grid für KPIs.
Source code in toolboxv2/mods/Minu/flows.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
ui_for_data(data, title=None, editable=False, on_save=None)
¶
Generiert automatisch eine UI für beliebige Daten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Python-Daten (dict, list, primitiv) |
required |
title
|
Optional[str]
|
Optional Titel |
None
|
editable
|
bool
|
Editierbar? |
False
|
on_save
|
Union[str, Callable, None]
|
Save-Handler |
None
|
Source code in toolboxv2/mods/Minu/flows.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
ui_result(component, title=None)
¶
Wrap Component für Flow-Return.
Source code in toolboxv2/mods/Minu/flows.py
549 550 551 552 553 554 | |
shared
¶
Minu Shared Data System¶
Kontrollierter Echtzeit-Datenaustausch zwischen Nutzern.
Features: - Shared Sections: Geteilte Bereiche die für mehrere Nutzer live synchronisiert werden - Cross-User Support: Angemeldete, anonyme und gemischte Gruppen - BlobDB Integration: Persistente Speicherung - WebSocket-basierte Live-Updates - Zugriffskontrolle: Owner, Participants, Permissions
Use Cases: - Multiplayer Games - Chat/Messaging - Collaborative Editing - Real-time Dashboards - Shared Whiteboards
ParticipantType
¶
Bases: str, Enum
Typ des Teilnehmers
Source code in toolboxv2/mods/Minu/shared.py
54 55 56 57 | |
SharedChange
dataclass
¶
Eine Änderung in einer Shared Section
Source code in toolboxv2/mods/Minu/shared.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
SharedManager
¶
Manager für Shared Sections. Singleton pro App.
Source code in toolboxv2/mods/Minu/shared.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | |
create(request, name, initial_data=None, max_participants=100, allow_anonymous=True, default_permission=SharedPermission.WRITE, public=False)
async
¶
Neue Shared Section erstellen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
RequestData
|
Request mit User-Info |
required |
name
|
str
|
Name der Section |
required |
initial_data
|
Dict[str, Any]
|
Initiale Daten |
None
|
max_participants
|
int
|
Max. Teilnehmer |
100
|
allow_anonymous
|
bool
|
Anonyme erlauben |
True
|
default_permission
|
SharedPermission
|
Standard-Berechtigung |
WRITE
|
public
|
bool
|
Öffentlich auffindbar |
False
|
Returns:
| Type | Description |
|---|---|
SharedSection
|
SharedSection Instanz |
Source code in toolboxv2/mods/Minu/shared.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
delete(section_id, request)
async
¶
Section löschen (nur Owner)
Source code in toolboxv2/mods/Minu/shared.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |
get(section_id)
async
¶
Section laden (aus Cache oder DB)
Source code in toolboxv2/mods/Minu/shared.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
get_(app)
classmethod
¶
Singleton-Instanz für App
Source code in toolboxv2/mods/Minu/shared.py
536 537 538 539 540 541 542 | |
join(section_id, request, session=None)
async
¶
Section beitreten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_id
|
str
|
ID der Section |
required |
request
|
RequestData
|
Request mit User-Info |
required |
session
|
MinuSession
|
MinuSession für Live-Updates |
None
|
Returns:
| Type | Description |
|---|---|
SharedSection | None
|
SharedSection oder None wenn nicht erlaubt |
Source code in toolboxv2/mods/Minu/shared.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
leave(section_id, request)
async
¶
Section verlassen
Source code in toolboxv2/mods/Minu/shared.py
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
list_public(limit=50)
async
¶
Öffentliche Sections auflisten
Source code in toolboxv2/mods/Minu/shared.py
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
list_user_sections(request)
async
¶
Sections eines Users auflisten
Source code in toolboxv2/mods/Minu/shared.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | |
SharedMixin
¶
Mixin für MinuView mit Shared-Funktionalität.
Usage
class GameView(MinuView, SharedMixin): async def on_mount(self): self.shared = await self.join_shared('game_lobby')
# Auf Änderungen reagieren
self.shared.on_change('state', self.on_state_change)
async def on_player_move(self, event):
await self.shared.set('players.0.position', event['position'])
Source code in toolboxv2/mods/Minu/shared.py
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |
shared_manager
property
¶
SharedManager Instanz
create_shared(name, initial_data=None, **kwargs)
async
¶
Neue Shared Section erstellen
Source code in toolboxv2/mods/Minu/shared.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | |
get_shared(section_id)
¶
Lokale Shared Section abrufen
Source code in toolboxv2/mods/Minu/shared.py
866 867 868 869 870 | |
join_shared(section_id)
async
¶
Shared Section beitreten
Source code in toolboxv2/mods/Minu/shared.py
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | |
leave_shared(section_id)
async
¶
Shared Section verlassen
Source code in toolboxv2/mods/Minu/shared.py
857 858 859 860 861 862 863 864 | |
SharedParticipant
dataclass
¶
Ein Teilnehmer in einer Shared Section
Source code in toolboxv2/mods/Minu/shared.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
SharedPermission
¶
Bases: str, Enum
Berechtigungen für Shared Sections
Source code in toolboxv2/mods/Minu/shared.py
46 47 48 49 50 51 | |
SharedSection
dataclass
¶
Eine geteilte Daten-Sektion für mehrere Nutzer.
Usage
Section erstellen¶
section = await SharedManager.create( app, request, name="game_lobby_123", initial_data={'players': [], 'state': 'waiting'} )
Daten ändern (wird automatisch an alle Teilnehmer gesendet)¶
await section.set('state', 'playing') await section.append('players', {'name': 'Player1', 'score': 0})
Auf Änderungen reagieren¶
section.on_change('state', lambda change: print(f"State: {change.value}"))
Source code in toolboxv2/mods/Minu/shared.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
add_participant(participant)
async
¶
Teilnehmer hinzufügen
Source code in toolboxv2/mods/Minu/shared.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
append(path, value, author_id='')
async
¶
Wert zu Liste hinzufügen.
Source code in toolboxv2/mods/Minu/shared.py
258 259 260 261 262 263 264 265 266 267 268 | |
delete(path, author_id='')
async
¶
Daten löschen.
Source code in toolboxv2/mods/Minu/shared.py
283 284 285 286 287 288 289 290 291 292 293 | |
get(path=None, default=None)
¶
Daten lesen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Pfad zu den Daten (z.B. "state", "players.0.score") |
None
|
default
|
Any
|
Fallback-Wert |
None
|
Source code in toolboxv2/mods/Minu/shared.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
has_permission(participant_id, required)
¶
Berechtigung prüfen
Source code in toolboxv2/mods/Minu/shared.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
merge(path, value, author_id='')
async
¶
Dict-Daten mergen (shallow merge).
Source code in toolboxv2/mods/Minu/shared.py
246 247 248 249 250 251 252 253 254 255 256 | |
off_change(path, handler=None)
¶
Handler entfernen
Source code in toolboxv2/mods/Minu/shared.py
437 438 439 440 441 442 443 | |
on_change(path, handler)
¶
Handler für Änderungen an einem Pfad registrieren.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Pfad oder "*" für alle Änderungen |
required |
handler
|
Callable[[SharedChange], Any]
|
Callback(change: SharedChange) |
required |
Source code in toolboxv2/mods/Minu/shared.py
425 426 427 428 429 430 431 432 433 434 435 | |
remove(path, value=None, index=None, author_id='')
async
¶
Wert aus Liste entfernen (by value oder index).
Source code in toolboxv2/mods/Minu/shared.py
270 271 272 273 274 275 276 277 278 279 280 281 | |
remove_participant(participant_id)
async
¶
Teilnehmer entfernen
Source code in toolboxv2/mods/Minu/shared.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |
set(path, value, author_id='')
async
¶
Daten setzen und an alle Teilnehmer broadcasten.
Source code in toolboxv2/mods/Minu/shared.py
234 235 236 237 238 239 240 241 242 243 244 | |
update_participant(participant_id, permission=None)
async
¶
Teilnehmer aktualisieren
Source code in toolboxv2/mods/Minu/shared.py
503 504 505 506 507 508 509 510 511 512 513 514 515 | |
shared_api
¶
API Endpunkte für Shared Sections. Diese Endpunkte in init.py integrieren.
Ermöglicht: - REST API für Shared Section Management - WebSocket Events für Live-Updates
create_shared_section(app, request, name, initial_data=None, max_participants=100, allow_anonymous=True, default_permission='write', public=False)
async
¶
Neue Shared Section erstellen.
POST /api/Minu/shared/create { "name": "my_game_lobby", "initial_data": {"state": "waiting", "players": []}, "max_participants": 4, "allow_anonymous": true, "public": true }
Returns:
| Type | Description |
|---|---|
Result
|
Section ID und Details |
Source code in toolboxv2/mods/Minu/shared_api.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
delete_shared_section(app, request, section_id)
async
¶
Shared Section löschen (nur Owner).
DELETE /api/Minu/shared/delete?section_id=shared-abc123
Source code in toolboxv2/mods/Minu/shared_api.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_shared_section(app, request, section_id)
async
¶
Shared Section Details abrufen.
GET /api/Minu/shared/get?section_id=shared-abc123
Source code in toolboxv2/mods/Minu/shared_api.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
get_shared_websocket_handlers(app)
¶
WebSocket Handler für Shared Section Events. In den bestehenden Minu WebSocket Handler integrieren.
Neue Message Types: - shared_subscribe: Section abonnieren - shared_unsubscribe: Abo beenden - shared_update: Daten ändern
Source code in toolboxv2/mods/Minu/shared_api.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
join_shared_section(app, request, section_id)
async
¶
Shared Section beitreten.
POST /api/Minu/shared/join
Source code in toolboxv2/mods/Minu/shared_api.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
leave_shared_section(app, request, section_id)
async
¶
Shared Section verlassen.
POST /api/Minu/shared/leave
Source code in toolboxv2/mods/Minu/shared_api.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
list_shared_sections(app, request, public_only=False)
async
¶
Shared Sections des Users oder öffentliche auflisten.
GET /api/Minu/shared/list GET /api/Minu/shared/list?public_only=true
Source code in toolboxv2/mods/Minu/shared_api.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
update_shared_data(app, request, section_id, path, value, operation='set')
async
¶
Daten in Shared Section ändern.
POST /api/Minu/shared/update { "section_id": "shared-abc123", "path": "state", "value": "playing", "operation": "set" }
Source code in toolboxv2/mods/Minu/shared_api.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
user
¶
Minu User System¶
Einheitlicher Zugriff auf Nutzerdaten in allen MinuViews.
Features: - Automatische User-Property in jeder MinuView - Angemeldete Nutzer: Echtes User-Objekt + ModDataClient - Anonyme Nutzer: Pseudo-User mit Session-basierter Datenspeicherung
AnonymousUser
dataclass
¶
Pseudo-User für nicht angemeldete Nutzer. Speichert Daten in der Session statt in der DB.
Source code in toolboxv2/mods/Minu/user.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
uid
property
¶
Eindeutige ID basierend auf Session
delete_mod_data(mod_name, keys=None)
¶
Mod-Daten aus Session löschen.
Source code in toolboxv2/mods/Minu/user.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_mod_data(mod_name, key=None)
¶
Mod-Daten aus Session lesen. Synchrone Version für anonyme Nutzer.
Source code in toolboxv2/mods/Minu/user.py
59 60 61 62 63 64 65 66 67 | |
set_mod_data(mod_name, data, merge=True)
¶
Mod-Daten in Session speichern. Synchrone Version für anonyme Nutzer.
Source code in toolboxv2/mods/Minu/user.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
AuthenticatedUserWrapper
dataclass
¶
Wrapper für authentifizierte Nutzer. Bietet einheitliches Interface und ModDataClient-Integration.
Source code in toolboxv2/mods/Minu/user.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
raw
property
¶
Zugriff auf das originale User-Objekt
__getattr__(name)
¶
Proxy für alle anderen Attribute zum originalen User
Source code in toolboxv2/mods/Minu/user.py
155 156 157 158 159 | |
delete_mod_data(mod_name, keys=None)
async
¶
Mod-Daten über ModDataClient löschen
Source code in toolboxv2/mods/Minu/user.py
186 187 188 189 | |
get_mod_client(mod_name)
¶
ModDataClient für ein Modul erstellen. Cached pro mod_name.
Source code in toolboxv2/mods/Minu/user.py
161 162 163 164 165 166 167 168 169 170 171 172 | |
get_mod_data(mod_name, key=None)
async
¶
Mod-Daten über ModDataClient abrufen
Source code in toolboxv2/mods/Minu/user.py
174 175 176 177 | |
set_mod_data(mod_name, data, merge=True)
async
¶
Mod-Daten über ModDataClient speichern
Source code in toolboxv2/mods/Minu/user.py
179 180 181 182 183 184 | |
MinuUser
¶
Factory und Utility-Klasse für User-Erstellung.
Wird von MinuView verwendet um die user Property bereitzustellen.
Source code in toolboxv2/mods/Minu/user.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
create_anonymous(request)
staticmethod
¶
Anonymen User aus Request erstellen
Source code in toolboxv2/mods/Minu/user.py
250 251 252 253 254 255 256 257 258 259 260 261 | |
from_request(app, request)
async
staticmethod
¶
User aus Request erstellen. Gibt AuthenticatedUserWrapper oder AnonymousUser zurück.
Source code in toolboxv2/mods/Minu/user.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
from_request_sync(app, request)
staticmethod
¶
Synchrone Version - versucht gecachten User zu nutzen. Für Fälle wo async nicht möglich ist.
Source code in toolboxv2/mods/Minu/user.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
UserMixin
¶
Mixin für MinuView um User-Property bereitzustellen.
Usage
class MyView(MinuView, UserMixin): def render(self): if self.user.is_authenticated: return Text(f"Willkommen, {self.user.name}!") return Text("Bitte anmelden")
Source code in toolboxv2/mods/Minu/user.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
user
property
¶
Aktueller User (angemeldet oder anonym).
Für angemeldete Nutzer
- user.name, user.uid, user.email, etc.
- user.get_mod_client('ModName') für ModDataClient
- await user.get_mod_data('ModName')
- await user.set_mod_data('ModName', {...})
Für anonyme Nutzer
- user.name == "anonymous"
- user.level == -1
- user.uid == "anon_
" - user.get_mod_data('ModName') (synchron, Session-basiert)
- user.set_mod_data('ModName', {...}) (synchron, Session-basiert)
ensure_user()
async
¶
Async User-Laden. Sollte zu Beginn eines Event-Handlers aufgerufen werden.
Usage
async def on_submit(self, event): user = await self.ensure_user() if user.is_authenticated: await user.set_mod_data('MyMod', {'score': 100})
Source code in toolboxv2/mods/Minu/user.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
set_app(app)
¶
App-Referenz setzen (wird von Session-Handler aufgerufen)
Source code in toolboxv2/mods/Minu/user.py
336 337 338 | |
P2PRPCClient
¶
P2PRPCClient
¶
Source code in toolboxv2/mods/P2PRPCClient.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
call(module, function, *args, **kwargs)
async
¶
Makes a remote procedure call.
Source code in toolboxv2/mods/P2PRPCClient.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
close()
async
¶
Closes the connection.
Source code in toolboxv2/mods/P2PRPCClient.py
133 134 135 136 137 138 | |
connect()
async
¶
Connects to the local tcm instance and performs key exchange.
Source code in toolboxv2/mods/P2PRPCClient.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
listen_for_responses()
async
¶
Listens for incoming responses, decrypts them, and resolves the corresponding future.
Source code in toolboxv2/mods/P2PRPCClient.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
test_rpc_client(app, host='127.0.0.1', port=8000, tb_r_key=None)
async
¶
An example of how to use the P2P RPC Client.
Source code in toolboxv2/mods/P2PRPCClient.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
P2PRPCServer
¶
P2PRPCServer
¶
Source code in toolboxv2/mods/P2PRPCServer.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
format_error(call_id, code, message, details=None)
¶
Helper to create a JSON-RPC error response object.
Source code in toolboxv2/mods/P2PRPCServer.py
137 138 139 140 141 142 143 144 145 146 147 148 | |
handle_client(reader, writer)
async
¶
Callback to handle a single client connection from a tcm instance.
Source code in toolboxv2/mods/P2PRPCServer.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
is_function_allowed(module, function, client_identification)
¶
Checks if a function is allowed for a given client identification.
Source code in toolboxv2/mods/P2PRPCServer.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
process_rpc(msg_data, session_key)
async
¶
Processes a single RPC request and returns a response dictionary.
Source code in toolboxv2/mods/P2PRPCServer.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
start()
async
¶
Starts the TCP server.
Source code in toolboxv2/mods/P2PRPCServer.py
150 151 152 153 154 155 156 157 158 | |
stop()
¶
Stops the TCP server.
Source code in toolboxv2/mods/P2PRPCServer.py
160 161 162 163 164 | |
start_rpc_server(app, host='127.0.0.1', port=8888, tb_r_key=None, function_access_config=None)
async
¶
Starts the P2P RPC server.
Source code in toolboxv2/mods/P2PRPCServer.py
166 167 168 169 170 171 172 173 174 175 176 177 178 | |
POA
¶
module
¶
ActionManagerEnhanced
¶
Source code in toolboxv2/mods/POA/module.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | |
PasswordManager
¶
ToolBox Password Manager Module Advanced password management with blob storage, device key encryption, and 2FA support api available at http://localhost:8080/api/PasswordManager/{function_name}
ImportResult
dataclass
¶
Result of password import operation
Source code in toolboxv2/mods/PasswordManager.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
PasswordEntry
dataclass
¶
Secure password entry data structure
Source code in toolboxv2/mods/PasswordManager.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
from_dict(data)
classmethod
¶
Create from dictionary
Source code in toolboxv2/mods/PasswordManager.py
96 97 98 99 | |
get_domain()
¶
Extract domain from URL
Source code in toolboxv2/mods/PasswordManager.py
115 116 117 118 119 120 121 | |
to_dict()
¶
Convert to dictionary for storage
Source code in toolboxv2/mods/PasswordManager.py
92 93 94 | |
update_password(new_password)
¶
Update password and maintain history
Source code in toolboxv2/mods/PasswordManager.py
101 102 103 104 105 106 107 108 109 110 111 112 113 | |
PasswordImporter
¶
Universal password manager import parser
Source code in toolboxv2/mods/PasswordManager.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
import_from_file(file_content, file_format, folder='Imported')
¶
Import passwords from various formats
Source code in toolboxv2/mods/PasswordManager.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
PasswordManagerCore
¶
Core password management functionality
Source code in toolboxv2/mods/PasswordManager.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
add_password(entry)
¶
Add new password entry
Source code in toolboxv2/mods/PasswordManager.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
delete_password(entry_id)
¶
Delete password entry
Source code in toolboxv2/mods/PasswordManager.py
284 285 286 287 288 289 290 291 292 293 294 295 296 | |
get_password(entry_id)
¶
Get password entry by ID
Source code in toolboxv2/mods/PasswordManager.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
get_password_by_url_username(url, username)
¶
Get password entry by URL and username
Source code in toolboxv2/mods/PasswordManager.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
list_passwords(folder=None, limit=100)
¶
List password entries
Source code in toolboxv2/mods/PasswordManager.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
search_passwords(query, limit=50)
¶
Search password entries
Source code in toolboxv2/mods/PasswordManager.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
update_password(entry_id, updates)
¶
Update password entry
Source code in toolboxv2/mods/PasswordManager.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
TOTPManager
¶
Time-based One-Time Password (2FA) manager
Source code in toolboxv2/mods/PasswordManager.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
generate_qr_code_uri(secret, account, issuer='')
staticmethod
¶
Generate TOTP QR code URI
Source code in toolboxv2/mods/PasswordManager.py
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
generate_totp_code(secret, time_step=30)
staticmethod
¶
Generate TOTP code from secret
Source code in toolboxv2/mods/PasswordManager.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
parse_totp_uri(uri)
staticmethod
¶
Parse TOTP URI (otpauth://totp/...)
Source code in toolboxv2/mods/PasswordManager.py
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
add_password(app, url, username, password, title='', notes='', folder='Default')
¶
Add new password entry
Source code in toolboxv2/mods/PasswordManager.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
add_totp_secret(app, entry_id, secret, issuer='', account='')
¶
Add TOTP secret to password entry
Source code in toolboxv2/mods/PasswordManager.py
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
delete_password(app, entry_id)
¶
Deletes a password entry by its ID.
Source code in toolboxv2/mods/PasswordManager.py
785 786 787 788 789 790 791 792 | |
generate_password(app, length=16, include_symbols=True, include_numbers=True, include_uppercase=True, include_lowercase=True, exclude_ambiguous=True)
¶
Generate secure password
Source code in toolboxv2/mods/PasswordManager.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
generate_totp_code(app, entry_id)
¶
Generate TOTP code for password entry
Source code in toolboxv2/mods/PasswordManager.py
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
get_password(app, entry_id)
¶
Get password entry by ID
Source code in toolboxv2/mods/PasswordManager.py
357 358 359 360 361 362 363 364 | |
get_password_for_autofill(app, url)
¶
Get password entry for browser autofill with improved matching.
Source code in toolboxv2/mods/PasswordManager.py
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 | |
get_pm_core(app)
¶
Initialisiert und gibt eine Singleton-Instanz des PasswordManagerCore zurück. Dies verhindert das wiederholte Laden der Datenbank bei jeder Anfrage.
Source code in toolboxv2/mods/PasswordManager.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
import_passwords(app, file_content, file_format, folder='Imported')
¶
Import passwords from file
Source code in toolboxv2/mods/PasswordManager.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |
list_passwords(app, folder=None, limit=100)
¶
List password entries
Source code in toolboxv2/mods/PasswordManager.py
377 378 379 380 381 382 383 384 | |
parse_totp_qr_code(app, qr_data)
¶
Parse TOTP QR code data
Source code in toolboxv2/mods/PasswordManager.py
819 820 821 822 823 824 825 826 | |
search_passwords(app, query, limit=50)
¶
Search password entries
Source code in toolboxv2/mods/PasswordManager.py
367 368 369 370 371 372 373 374 | |
SchedulerManager
¶
SchedulerManagerClass
¶
Source code in toolboxv2/mods/SchedulerManager.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
job_wrapper(job_name, job_function)
¶
Wrap a job function to track success and errors.
Source code in toolboxv2/mods/SchedulerManager.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
register_job(job_id, second=-1, func=None, job=None, time_passer=None, object_name=None, receive_job=False, save=False, max_live=False, serializer=serializer_default, args=None, kwargs=None)
¶
Parameters¶
job_id : str
id for the job for management
second : int
The time interval in seconds between each call of the job.
func : Callable or str
The function to be executed as the job.
job : schedule.Job
An existing job object from the schedule library.
time_passer : schedule.Job
A job without a function, used to specify the time interval.
object_name : str
The name of the object containing in the 'func' var to be executed.
receive_job : bool
A flag indicating whether the job should be received from an object from 'func' var.
save : bool
A flag indicating whether the job should be saved.
max_live : bool
A flag indicating whether the job should have a maximum live time.
serializer : dill
json pickel or dill must have a dumps fuction
*args, **kwargs : Any serializable and deserializable
Additional arguments to be passed to the job function.
Returns¶
Source code in toolboxv2/mods/SchedulerManager.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
Tools
¶
Bases: MainTool, SchedulerManagerClass
Source code in toolboxv2/mods/SchedulerManager.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
register_instance(job_data)
¶
example dicts
{ "job_id": "job0", "second": 0, "func": None, "job": None, "time_passer": None, "object_name": "tb_job_fuction", "receive_job": False, "save": False, "max_live": True, # just lev it out "serializer": serializer_default, "args": [], "kwargs": {}, }
job_id : str id for the job for management second (optional): int The time interval in seconds between each call of the job. func (optional): Callable or str The function to be executed as the job. job (optional): schedule.Job An existing job object from the schedule library. time_passer (optional): schedule.Job A job without a function, used to specify the time interval. object_name (optional): str The name of the object containing in the 'func' var to be executed. receive_job (optional): bool A flag indicating whether the job should be received from an object from 'func' var. save (optional): bool A flag indicating whether the job should be saved. max_live (optional): bool A flag indicating whether the job should have a maximum live time. serializer (optional): bool json pickel or dill must have a dumps fuction args, *kwargs (optional): Additional arguments to be passed to the job function.
Parameters ---------- job_data : dict
example usage ---------- `python
`
Source code in toolboxv2/mods/SchedulerManager.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
SocketManager
¶
The SocketManager Supports 2 types of connections 1. Client Server 2. Peer to Peer
TTS
¶
ToolBox High-Quality Text-to-Speech (TTS) Module Supports both local offline TTS and high-quality online TTS API available at http://localhost:8080/api/TTS/{function_name}
get_engine_status(app)
¶
Check which TTS engines are available.
Returns:
| Type | Description |
|---|---|
Result
|
Result object with engine availability status |
Source code in toolboxv2/mods/TTS.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
list_voices(app, engine='edge')
¶
Lists available voices for the specified engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
engine
|
str
|
Engine to list voices for ('edge' or 'local') |
'edge'
|
Returns:
| Type | Description |
|---|---|
Result
|
Result object with available voices |
Source code in toolboxv2/mods/TTS.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
speak(app, text='', lang='de', engine='auto', rate=150)
async
¶
Converts text to high-quality speech and returns it as a base64 encoded audio string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
Application instance |
required |
text
|
str
|
Text to convert to speech |
''
|
lang
|
str
|
Language code (de, en, es, fr, it, pt, ru, ja, zh, ko, ar, hi, nl, pl, tr) |
'de'
|
engine
|
Literal['auto', 'edge', 'local']
|
TTS engine to use ('auto', 'edge' for high quality online, 'local' for offline) |
'auto'
|
rate
|
int
|
Speech rate for local engine (words per minute, default 150) |
150
|
Returns:
| Type | Description |
|---|---|
Result
|
Result object with base64 encoded audio |
Source code in toolboxv2/mods/TTS.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
TruthSeeker
¶
arXivCrawler
¶
ArXiv Crawler for TruthSeeker. Main module for processing research queries.
ArXivPDFProcessor
¶
Main processor for research queries. This is a wrapper around the new ResearchProcessor for backward compatibility.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
__init__(query, tools, chunk_size=1000000, overlap=2000, max_workers=None, num_search_result_per_query=6, max_search=6, download_dir='pdfs', callback=None, num_workers=None)
¶
Initialize the ArXiv PDF processor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Research query |
required |
tools
|
Tools module |
required | |
chunk_size
|
int
|
Size of text chunks for processing |
1000000
|
overlap
|
int
|
Overlap between chunks |
2000
|
max_workers
|
Maximum number of worker threads |
None
|
|
num_search_result_per_query
|
Number of search results per query |
6
|
|
max_search
|
Maximum number of search queries |
6
|
|
download_dir
|
Directory to save downloaded files |
'pdfs'
|
|
callback
|
Callback function for status updates |
None
|
|
num_workers
|
Number of worker threads |
None
|
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
estimate_processing_metrics(query_length, **config)
staticmethod
¶
Return estimated time (seconds) and price for processing.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
search_and_process_papers(queries)
async
¶
Search for and process papers based on queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queries
|
list[str]
|
List of search queries |
required |
Returns:
| Type | Description |
|---|---|
list[Paper]
|
List of processed papers |
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
send_status(step, progress=None, additional_info='')
¶
Send status update via callback.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
322 323 324 325 326 327 328 329 330 | |
main(query='Beste strategien in bretspielen sitler von katar')
async
¶
Main execution function
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
nGui
¶
import colorsys import json import time from datetime import datetime, timedelta from queue import Queue from typing import Dict, Union, List, Any
import os import random from threading import Thread, Event
import networkx as nx from dataclasses import asdict
from toolboxv2 import get_app from toolboxv2.mods.FastApi.fast_nice import register_nicegui
import asyncio
from nicegui import ui
from pathlib import Path import stripe
from toolboxv2.mods.TruthSeeker.arXivCrawler import Paper from toolboxv2.mods.isaa.base.AgentUtils import anything_from_str_to_dict
Set your secret key (use environment variables in production!)¶
stripe.api_key = os.getenv('STRIPE_SECRET_KEY', 'sk_test_YourSecretKey')
def create_landing_page(): # Set up dynamic background ui.query("body").style("background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)")
# Main container with enhanced responsive design
with ui.column().classes(
"w-full max-w-md p-8 rounded-3xl shadow-2xl "
"items-center self-center mx-auto my-8"
):
# Advanced styling for glass-morphism effect
ui.query(".nicegui-column").style("""
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease-in-out;
""")
# Animated logo/brand icon
with ui.element("div").classes("animate-fadeIn"):
ui.icon("science").classes(
"text-7xl mb-6 text-primary "
"transform hover:scale-110 transition-transform"
)
# Enhanced typography for title
ui.label("TruthSeeker").classes(
"text-5xl font-black text-center "
"text-primary mb-2 animate-slideDown"
)
# Stylized subtitle with brand message
ui.label("Precision. Discovery. Insights.").classes(
"text-xl font-medium text-center "
"mb-10 animate-fadeIn"
)
# Button container for consistent spacing
ui.button(
"Start Research",
on_click=lambda: ui.navigate.to("/open-Seeker.seek")
).classes(
"w-full px-6 py-4 text-lg font-bold "
"bg-primary hover:bg-primary-dark "
"transform hover:-translate-y-0.5 "
"transition-all duration-300 ease-in-out "
"rounded-xl shadow-lg animate-slideUp"
)
# Navigation links container
with ui.element("div").classes("mt-8 space-y-3 text-center"):
ui.link(
"Demo video",
).classes(
"block text-lg text-gray-200 hover:text-primary "
"transition-colors duration-300 animate-fadeIn"
).on("click", lambda: ui.navigate.to("/open-Seeker.demo"))
ui.link(
"About Us",
).classes(
"block text-lg text-gray-400 hover:text-primary "
"transition-colors duration-300 animate-fadeIn"
).on("click", lambda: ui.navigate.to("/open-Seeker.about"))
def create_video_demo(): with ui.card().classes('w-full max-w-3xl mx-auto').style( 'background: var(--background-color); color: var(--text-color)'): # Video container with responsive aspect ratio with ui.element('div').classes('relative w-full aspect-video'): video = ui.video('../api/TruthSeeker/video').classes('w-full h-full object-cover')
# Custom controls overlay
with ui.element('div').classes('absolute bottom-0 left-0 right-0 bg-black/50 p-2'):
with ui.row().classes('items-center gap-2'):
#play_btn = ui.button(icon='play_arrow', on_click=lambda: video.props('playing=true'))
#pause_btn = ui.button(icon='pause', on_click=lambda: video.props('playing=false'))
ui.slider(min=0, max=100, value=0).classes('w-full').bind_value(video, 'time')
#mute_btn = ui.button(icon='volume_up', on_click=lambda: video.props('muted=!muted'))
#fullscreen_btn = ui.button(icon='fullscreen', on_click=lambda: video.props('fullscreen=true'))
# Video description
ui.markdown('Walkthrough of TruthSeeker features and capabilities.')
# Back to Home Button
ui.button('Back to Home', on_click=lambda: ui.navigate.to('/open-Seeker')).classes(
'mt-6 w-full bg-primary text-white hover:opacity-90'
)
return video
def create_about_page(): """Create a comprehensive About page for TruthSeeker""" with ui.column().classes('w-full max-w-4xl mx-auto p-6'): # Page Header ui.label('About TruthSeeker').classes('text-4xl font-bold text-primary mb-6')
# Mission Statement
with ui.card().classes('w-full mb-6').style(
'background: var(--background-color); color: var(--text-color); padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);'
):
ui.label('Our Mission').classes('text-2xl font-semibold text-primary mb-4')
ui.markdown("""
TruthSeeker aims to democratize access to scientific knowledge,
transforming complex academic research into comprehensible insights.
We bridge the gap between raw data and meaningful understanding.
""").classes('text-lg').style('color: var(--text-color);')
# Core Technologies
with ui.card().classes('w-full mb-6').style(
'background: var(--background-color); color: var(--text-color); padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);'
):
ui.label('Core Technologies').classes('text-2xl font-semibold text-primary mb-4')
with ui.row().classes('gap-4 w-full'):
with ui.column().classes('flex-1 text-center'):
ui.icon('search').classes('text-4xl text-primary mb-2')
ui.label('Advanced Query Processing').classes('font-bold')
ui.markdown('Intelligent algorithms that extract nuanced research insights.').style(
'color: var(--text-color);')
with ui.column().classes('flex-1 text-center'):
ui.icon('analytics').classes('text-4xl text-primary mb-2')
ui.label('Semantic Analysis').classes('font-bold')
ui.markdown('Deep learning models for comprehensive research verification.').style(
'color: var(--text-color);')
with ui.column().classes('flex-1 text-center'):
ui.icon('verified').classes('text-4xl text-primary mb-2')
ui.label('Research Validation').classes('font-bold')
ui.markdown('Multi-layered verification of academic sources.').style('color: var(--text-color);')
# Research Process
with ui.card().classes('w-full').style('background: var(--background-color);color: var(--text-color);'):
ui.label('Research Discovery Process').classes('text-2xl font-semibold text-primary mb-4')
with ui.card().classes('q-pa-md q-mx-auto').style(
'max-width: 800px; background: var(--background-color); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);'
) as card:
ui.markdown("# Research Workflow").style(
"color: var(--primary-color); text-align: center; margin-bottom: 20px;")
ui.markdown(
"""
Welcome to TruthSeeker’s interactive research assistant. Follow the steps below to transform your initial inquiry into a refined, actionable insight.
"""
).style("color: var(--text-color); text-align: center; margin-bottom: 30px;")
# The stepper component
with ui.stepper().style('background: var(--background-color); color: var(--text-color);') as stepper:
# Step 1: Query Initialization
with ui.step('Query Initialization'):
ui.markdown("### Step 1: Query Initialization").style("color: var(--primary-color);")
ui.markdown(
"""
Begin by entering your research question or selecting from popular academic domains.
This sets the direction for our semantic analysis engine.
"""
).style("color: var(--text-color); margin-bottom: 20px;")
with ui.stepper_navigation():
ui.button('Next', on_click=stepper.next).props('rounded color=primary')
# Step 2: Semantic Search
with ui.step('Semantic Search'):
ui.markdown("### Step 2: Semantic Search").style("color: var(--primary-color);")
ui.markdown(
"""
Our advanced algorithms now process your input to generate context-rich queries.
This stage refines the search context by understanding the deeper intent behind your question.
"""
).style("color: var(--text-color); margin-bottom: 20px;")
with ui.stepper_navigation():
ui.button('Back', on_click=stepper.previous).props('flat')
ui.button('Next', on_click=stepper.next).props('rounded color=primary')
# Step 3: Document Analysis
with ui.step('Document Analysis'):
ui.markdown("### Step 3: Document Analysis").style("color: var(--primary-color);")
ui.markdown(
"""
The system then dives into a detailed analysis of academic papers, parsing content to extract key insights and connections.
This ensures that even subtle but crucial information is captured.
"""
).style("color: var(--text-color); margin-bottom: 20px;")
with ui.stepper_navigation():
ui.button('Back', on_click=stepper.previous).props('flat')
ui.button('Next', on_click=stepper.next).props('rounded color=primary')
# Step 4: Insight Generation
with ui.step('Insight Generation'):
ui.markdown("### Step 4: Insight Generation").style("color: var(--primary-color);")
ui.markdown(
"""
Finally, we synthesize the analyzed data into clear, actionable research summaries.
These insights empower you with concise guidance to drive further inquiry or practical application.
"""
).style("color: var(--text-color); margin-bottom: 20px;")
with ui.stepper_navigation():
ui.button('Back', on_click=stepper.previous).props('flat')
# Back to Home Button
ui.button('Back to Home', on_click=lambda: ui.navigate.to('/open-Seeker')).classes(
'mt-6 w-full bg-primary text-white hover:opacity-90'
)
Dummy-Implementierung für get_tools()¶
def get_tools(): """ Hier solltest du dein richtiges Werkzeug-Objekt zurückliefern. In diesem Beispiel gehen wir davon aus, dass du über eine Funktion wie get_app verfügst. """ return get_app("ArXivPDFProcessor", name=None).get_mod("isaa")
def create_graph_tab(processor_instance: Dict, graph_ui: ui.element, main_ui: ui.element): """Create and update the graph visualization"""
# Get HTML graph from processor
_html_content = processor_instance["instance"].tools.get_memory(processor_instance["instance"].mem_name)
html_content = "" if isinstance(_html_content, list) else _html_content.vis(get_output_html=True)
# Ensure static directory exists
static_dir = Path('dist/static')
static_dir.mkdir(exist_ok=True)
# Save HTML to static file
graph_file = static_dir / f'graph{processor_instance["instance"].mem_name}.html'
# Save HTML to static file with added fullscreen functionality
# Add fullscreen JavaScript
graph_file.write_text(html_content, encoding='utf-8')
with main_ui:
# Clear existing content except fullscreen button
graph_ui.clear()
with graph_ui:
ui.html(f"""
<iframe
src="/static/graph{processor_instance["instance"].mem_name}.html"
style="width: 100%; height: 800px; border: none; background: #1a1a1a;"
>
</iframe>
""").classes('w-full h-full')
is_init = [False]
--- Database Setup ---¶
def get_db(): db = get_app().get_mod("DB") if not is_init[0]: is_init[0] = True db.edit_cli("LD") db.initialize_database() return db
import pickle
--- Session State Management ---¶
def get_user_state(session_id: str, is_new=False) -> dict: db = get_db() state_ = { 'balance': .5, 'last_reset': datetime.utcnow().isoformat(), 'research_history': [], 'payment_id': '', } if session_id is None: state_['balance'] *= -1 if is_new: return state_, True return state_ state = db.get(f"TruthSeeker::session:{session_id}") if state.get() is None: state = state_ if is_new: return state_, True else: try: state = pickle.loads(state.get()) except Exception as e: print(e) state = { 'balance': 0.04, 'last_reset': datetime.utcnow().isoformat(), 'research_history': ["Sorry we had an error recreating your state"], 'payment_id': '', } if is_new: return state, True if is_new: return state, False return state
def save_user_state(session_id: str, state: dict): db = get_db() print("Saving state") db.set(f"TruthSeeker::session:{session_id}", pickle.dumps(state)).print()
def delete_user_state(session_id: str): db = get_db() print("Saving state") db.delete(f"TruthSeeker::session:{session_id}").print()
def reset_daily_balance(state: dict, valid=False) -> dict: now = datetime.utcnow() last_reset = datetime.fromisoformat(state.get('last_reset', now.isoformat())) if now - last_reset > timedelta(hours=24): state['balance'] = max(state.get('balance', 1.6 if valid else 0.5), 1.6 if valid else 0.5) state['last_reset'] = now.isoformat() return state
class MemoryResultsDisplay
def init(self, results: List[Dict[str, Any]], main_ui: ui.element): self.results = results self.main_ui = main_ui self.setup_ui()
def setup_ui(self): """Set up the main UI for displaying memory results""" with self.main_ui: self.main_ui.clear() with ui.column().classes('w-full'): for mem_result in self.results: self.create_memory_card(mem_result)
def create_memory_card(self, mem_result: Dict[str, Any]): """Create a card for each memory result""" result = mem_result.get("result", {}) with self.main_ui: if isinstance(result, dict): self.display_dict_result(result) elif hasattr(result, 'overview'): # Assuming RetrievalResult type self.display_retrieval_result(result) else: ui.label("Unsupported result type").classes('--text-color:error')
def display_dict_result(self, result: Dict[str, Any]): """Display dictionary-based result with collapsible sections""" # Summary Section summary = result.get("summary", {}) if isinstance(summary, str): try: summary = json.loads(summary[:-1]) except json.JSONDecodeError: summary = {"error": "Could not parse summary"}
# Raw Results Section
raw_results = result.get("raw_results", {})
if isinstance(raw_results, str):
try:
raw_results = json.loads(raw_results[:-1])
except json.JSONDecodeError:
raw_results = {"error": "Could not parse raw results"}
# Metadata Section
metadata = result.get("metadata", {})
with self.main_ui:
# Collapsible Sections
with ui.column().classes('w-full space-y-2').style("max-width: 100%;"):
# Summary Section
with ui.expansion('Summary', icon='description').classes('w-full') as se:
self.display_nested_data(summary, main_ui=se)
# Raw Results Section
with ui.expansion('Raw Results', icon='work').classes('w-full') as re:
self.display_nested_data(raw_results, main_ui=re)
# Metadata Section
if metadata:
with ui.expansion('Metadata', icon='info').classes('w-full'):
ui.markdown(f"```json
{json.dumps(metadata, indent=2)} ```").style("max-width: 100%;")
def display_retrieval_result(self, result):
"""Display retrieval result with detailed sections"""
with self.main_ui:
with ui.column().classes('w-full space-y-4').style("max-width: 100%;"):
# Overview Section
with ui.expansion('Overview', icon='visibility').classes('w-full') as ov:
for overview_item in result.overview:
if isinstance(overview_item, str):
overview_item = json.loads(overview_item)
self.display_nested_data(overview_item, main_ui=ov)
# Details Section
with ui.expansion('Details', icon='article').classes('w-full'):
for chunk in result.details:
with ui.card().classes('w-full p-3 mb-2').style("background: var(--background-color)"):
ui.label(chunk.text).classes('font-medium mb-2 --text-color:secondary')
with ui.row().classes('w-full justify-between').style("background: var(--background-color)"):
ui.label(f"Embedding Shape: {chunk.embedding.shape}").classes('text-sm')
ui.label(f"Content Hash: {chunk.content_hash}").classes('text-sm')
if chunk.cluster_id is not None:
ui.label(f"Cluster ID: {chunk.cluster_id}").classes('text-sm')
# Cross References Section
with ui.expansion('Cross References', icon='link').classes('w-full'):
for topic, chunks in result.cross_references.items():
with ui.card().classes('w-full p-3 mb-2').style("background: var(--background-color)"):
ui.label(topic).classes('font-semibold mb-2 --text-color:secondary')
for chunk in chunks:
ui.label(chunk.text).classes('text-sm mb-1')
def display_nested_data(self, data: Union[Dict, List], indent: int = 0, main_ui=None):
"""Recursively display nested dictionary or list data"""
with (self.main_ui if main_ui is None else main_ui):
if isinstance(data, dict):
with ui.column().classes(f'ml-{indent * 2}').style("max-width: 100%;"):
for key, value in data.items():
with ui.row().classes('items-center'):
ui.label(f"{key}:").classes('font-bold mr-2 --text-color:primary')
if isinstance(value, list):
if key == "main_chunks":
continue
self.display_nested_data(value, indent + 1, main_ui=main_ui)
if isinstance(value, dict):
ui.markdown(f"```json
{json.dumps(value, indent=2)}
").classes("break-words w-full").style("max-width: 100%;")
else:
ui.label(str(value)).classes('--text-color:secondary')
elif isinstance(data, list):
with ui.column().classes(f'ml-{indent * 2}').style("max-width: 100%;"):
for item in data:
if isinstance(item, str):
item = json.loads(item)
if isinstance(item, list):
self.display_nested_data(item, indent + 1, main_ui=main_ui)
if isinstance(item, dict):
ui.markdown(f"json
{json.dumps(item, indent=2)}
```").classes("break-words w-full").style("max-width: 100%;")
else:
ui.label(str(item)).classes('--text-color:secondary')
def create_followup_section(processor_instance: Dict, main_ui: ui.element, session_id, balance): main_ui.clear() with main_ui: ui.label("Query Interface (1ct)").classes("text-xl font-semibold mb-4")
# Container for query inputs
query_container = ui.column().classes("w-full gap-4")
query = "" # Store references to query inputs
# Query parameters section
with ui.expansion("Query Parameters", icon="settings").classes("w-full") as query_e:
with ui.grid(columns=2).classes("w-full gap-4"):
k_input = ui.number("Results Count (k)", value=2, min=1, max=20)
min_sim = ui.number("Min Similarity", value=.3, min=0, max=1, step=0.1)
cross_depth = ui.number("Cross Reference Depth", value=2, min=1, max=5)
max_cross = ui.number("Max Cross References", value=10, min=1, max=20)
max_sent = ui.number("Max Sentences", value=10, min=1, max=50)
unified = ui.switch("Unified Retrieve (+3ct)", value=True)
# Results display
with ui.element("div").classes("w-full mt-4") as results_display:
pass
results_display = results_display
with query_container:
query_input = ui.input("Query", placeholder="Enter your query...") .classes("w-full")
# Control buttons
with ui.row().classes("w-full gap-4 mt-4"):
ui.button("Execute Query", on_click=lambda: asyncio.create_task(execute_query())) .classes("bg-green-600 hover:bg-green-700")
ui.button("Clear Results", on_click=lambda: results_display.clear()) .classes("bg-red-600 hover:bg-red-700")
query_input = query_input
async def execute_query():
"""Execute a single query with parameters"""
nonlocal query_input, results_display, main_ui
try:
query_text = query_input.value
if not query_text.strip():
with main_ui:
ui.notify("No Input", type="warning")
return ""
if not processor_instance.get("instance"):
with main_ui:
ui.notify("No active processor instance", type="warning")
return
# Collect parameters
params = {
"k": int(k_input.value),
"min_similarity": min_sim.value,
"cross_ref_depth": int(cross_depth.value),
"max_cross_refs": int(max_cross.value),
"max_sentences": int(max_sent.value),
"unified": unified.value
}
# Construct query parameters
query_params = {
"k": params["k"],
"min_similarity": params["min_similarity"],
"cross_ref_depth": params["cross_ref_depth"],
"max_cross_refs": params["max_cross_refs"],
"max_sentences": params["max_sentences"]
}
# Execute query
results = await processor_instance["instance"].extra_query(
query=query_text,
query_params=query_params,
unified_retrieve=params["unified"]
)
print("results",results)
s = get_user_state(session_id)
s['balance'] -= .04 if unified.value else .01
save_user_state(session_id, s)
with main_ui:
balance.set_text(f"Balance: {s['balance']:.2f}€")
# Format results
with main_ui:
with results_display:
MemoryResultsDisplay(results, results_display)
except Exception as e:
return f"Error executing query: {str(e)}
"
# Add initial query input
online_states = [0] def create_research_interface(Processor):
def helpr(request, session: dict):
state = {'balance':0, 'research_history': []}
main_ui = None
with ui.column().classes("w-full max-w-6xl mx-auto p-6 space-y-6") as loading:
ui.spinner(size='lg')
ui.label('Initializing...').classes('ml-2')
# Container for main content (initially hidden)
content = ui.column().classes('hidden')
# Extract session data before spawning thread
session_id = session.get('ID')
session_id_h = session.get('IDh')
session_rid = request.row.query_params.get('session_id') if hasattr(request, 'row') else request.query_params.get('session_id')
session_valid = session.get('valid')
# Thread communication
result_queue = Queue()
ready_event = Event()
def init_background():
nonlocal session_id, session_id_h, session_rid, session_valid
try:
# Original initialization logic
_state, is_new = get_user_state(session_id, is_new=True)
if is_new and session_id_h != "#0":
_state = get_user_state(session_id_h)
save_user_state(session_id, _state)
delete_user_state(session_id_h)
if session_rid:
state_: dict
state_, is_new_ = get_user_state(session_rid, is_new=True)
if not is_new_:
_state = state_.copy()
state_['payment_id'] = ''
state_['last_reset'] = datetime.utcnow().isoformat()
state_['research_history'] = state_['research_history'][:3]
state_['balance'] = 0
save_user_state(session_id, _state)
_state = reset_daily_balance(_state, session_valid)
save_user_state(session_id, _state)
# Send result back to main thread
result_queue.put(_state)
ready_event.set()
except Exception as e:
result_queue.put(e)
ready_event.set()
# Start background initialization
Thread(target=init_background).start()
def check_ready():
nonlocal state
if ready_event.is_set():
result = result_queue.get()
# Check if initialization failed
if isinstance(result, Exception):
loading.clear()
with loading:
ui.label(f"Error during initialization: {str(result)}").classes('text-red-500')
return
# Get state and build main UI
state = result
loading.classes('hidden')
content.classes(remove='hidden')
main_ui.visible = True
with main_ui:
balance.set_text(f"Balance: {state['balance']:.2f}€")
show_history()
return # Stop the timer
# Check again in 100ms
ui.timer(0.1, check_ready, once=True)
# Start checking for completion
check_ready()
# Wir speichern die aktive Instanz, damit Follow-Up Fragen gestellt werden können
processor_instance = {"instance": None}
# UI-Elemente als Platzhalter; wir definieren sie später in der UI und machen sie so
# in den Callback-Funktionen über "nonlocal" verfügbar.
overall_progress = None
status_label = None
results_card = None
summary_content = None
analysis_content = None
references_content = None
followup_card = None
research_card = None
config_cart = None
progress_card = None
balance = None
graph_ui = None
sr_button = None
r_button = None
r_text = None
# Global config storage with default values
config = {
'chunk_size': 21000,
'overlap': 600,
'num_search_result_per_query': 3,
'max_search': 3,
'num_workers': None
}
def update_estimates():
"""
Dummy estimation based on query length and configuration.
(Replace with your own non-linear formula if needed.)
"""
query_text = query.value or ""
query_length = len(query_text)
# For example: estimated time scales with chunk size and query length.
estimated_time ,estimated_price = Processor.estimate_processing_metrics(query_length, **config)
estimated_time *= max(1, online_states[0] * 6)
if processor_instance["instance"] is not None:
estimated_price += .25
if estimated_time < 60:
time_str = f"~{int(estimated_time)}s"
elif estimated_time < 3600:
minutes = estimated_time // 60
seconds = estimated_time % 60
time_str = f"~{int(minutes)}m {int(seconds)}s"
else:
hours = estimated_time // 3600
minutes = (estimated_time % 3600) // 60
time_str = f"~{int(hours)}h {int(minutes)}m"
with main_ui:
query_length_label.set_text(f"Total Papers: {config['max_search']*config['num_search_result_per_query']}")
time_label.set_text(f"Processing Time: {time_str}")
price_label.set_text(f"Price: {estimated_price:.2f}€")
return estimated_price
def on_config_change(event):
"""
Update the global config based on input changes and recalc estimates.
"""
try:
config['chunk_size'] = int(chunk_size_input.value)
except ValueError:
pass
try:
config['overlap'] = int(overlap_input.value)
if config['overlap'] > config['chunk_size'] / 4:
config['overlap'] = int(config['chunk_size'] / 4)
with main_ui:
overlap_input.value = config['overlap']
except ValueError:
pass
try:
config['num_search_result_per_query'] = int(num_search_result_input.value)
except ValueError:
pass
try:
config['max_search'] = int(max_search_input.value)
except ValueError:
pass
try:
config['num_workers'] = int(num_workers_input.value) if num_workers_input.value != 0 else None
except ValueError:
config['num_workers'] = None
update_estimates()
def on_query_change():
update_estimates()
# Callback, der vom Processor (über processor_instance.callback) aufgerufen wird.
def update_status(data: dict):
nonlocal overall_progress, status_label
if not data:
return
# Aktualisiere den Fortschrittsbalken und den aktuellen Schritt (wenn vorhanden)
with main_ui:
if isinstance(data, dict):
progress = data.get("progress", 0)
step = data.get("step", "Processing...")
overall_progress.value =round( progress ,2) # nicegui.linear_progress erwartet einen Wert zwischen 0 und 1
status_label.set_text(f"{step} {data.get('info','')}")
else:
status_label.set_text(f"{data}")
def start_search():
nonlocal balance
async def helper():
nonlocal processor_instance, overall_progress, status_label, results_card, summary_content, analysis_content,config, references_content, followup_card,sr_button,r_button,r_text
try:
if not validate_inputs():
with main_ui:
state['balance'] += est_price
save_user_state(session_id, state)
balance.set_text(f"Balance: {state['balance']:.2f}€")
return
reset_interface()
show_progress_indicators()
query_text = query.value.strip()
# Erzeuge das "tools"-Objekt (abhängig von deiner konkreten Implementation)
tools = get_tools()
with main_ui:
research_card.visible = False
config_cart.visible = False
config_section.visible = False
query.set_value("")
# Direkt instanziieren: Eine neue ArXivPDFProcessor-Instanz
if processor_instance["instance"] is not None:
processor = processor_instance["instance"]
processor.chunk_size = config['chunk_size']
processor.overlap = config['overlap']
processor.num_search_result_per_query = config['num_search_result_per_query']
processor.max_search = config['max_search']
processor.num_workers = config['num_workers']
papers, insights = await processor.process(query_text)
else:
processor = Processor(query_text, tools=tools, **config)
# Setze den Callback so, dass Updates in der GUI angezeigt werden
processor.callback = update_status
processor_instance["instance"] = processor
papers, insights = await processor.process()
update_results({
"papers": papers,
"insights": insights
})
with main_ui:
research_card.visible = True
config_cart.visible = True
show_history()
except Exception as e:
import traceback
with main_ui:
update_status({"progress": 0, "step": "Error", "info": str(e)})
state['balance'] += est_price
save_user_state(session_id, state)
balance.set_text(f"Balance: {state['balance']:.2f}€")
ui.notify(f"Error {str(e)})", type="negative")
research_card.visible = True
config_cart.visible = True
config_section.visible = True
print(traceback.format_exc())
def target():
get_app().run_a_from_sync(helper, )
est_price = update_estimates()
if est_price > state['balance']:
with main_ui:
ui.notify(f"Insufficient balance. Need €{est_price:.2f}", type='negative')
else:
state['balance'] -= est_price
save_user_state(session_id, state)
with main_ui:
online_states[0] += 1
balance.set_text(f"Balance: {state['balance']:.2f}€ Running Queries: {online_states[0]}")
Thread(target=target, daemon=True).start()
with main_ui:
online_states[0] -= 1
balance.set_text(f"Balance: {get_user_state(session_id)['balance']:.2f}€")
def show_history():
with config_cart:
for idx, entry in enumerate(state['research_history']):
with ui.card().classes("w-full backdrop-blur-lg bg-white/10 p-4"):
ui.label(entry['query']).classes('text-sm')
ui.button("Open").on_click(lambda _, i=idx: load_history(i))
def reset():
nonlocal processor_instance, results_card, followup_card, sr_button, r_button, r_text
processor_instance["instance"] = None
show_progress_indicators()
with main_ui:
config_cart.visible = False
config_section.visible = False
followup_card.visible = False
results_card.visible = False
r_button.visible = False
r_text.set_text("Research Interface")
sr_button.set_text("Start Research")
start_search()
# UI-Aufbau
with ui.column().classes("w-full max-w-6xl mx-auto p-6 space-y-6") as main_ui:
balance = ui.label(f"Balance: {state['balance']:.2f}€").classes("text-s font-semibold")
config_cart = config_cart
# --- Research Input UI Card ---
with ui.card().classes("w-full backdrop-blur-lg bg-white/10 p-4") as research_card:
r_text = ui.label("Research Interface").classes("text-3xl font-bold mb-4")
# Query input section with auto-updating estimates
query = ui.input("Research Query",
placeholder="Gib hier deine Forschungsfrage ein...",
value="") .classes("w-full min-h-[100px]") .on('change', lambda e: on_query_change()).style("color: var(--text-color)")
# --- Action Buttons ---
with ui.row().classes("mt-4"):
sr_button =ui.button("Start Research", on_click=start_search) .classes("bg-blue-600 hover:bg-blue-700 py-3 rounded-lg")
ui.button("toggle config",
on_click=lambda: setattr(config_section, 'visible', not config_section.visible) or show_progress_indicators()).style(
"color: var(--text-color)")
r_button = ui.button("Start new Research",
on_click=reset).style(
"color: var(--text-color)")
sr_button = sr_button
r_button = r_button
r_button.visible = False
research_card = research_card
# --- Options Cart / Configurations ---
with ui.card_section().classes("w-full backdrop-blur-lg bg-white/10 hidden") as config_section:
ui.separator()
ui.label("Configuration Options").classes("text-xl font-semibold mt-4 mb-2")
with ui.row():
chunk_size_input = ui.number(label="Chunk Size",
value=config['chunk_size'], format='%.0f', max=64_000, min=1000,
step=100) .on('change', on_config_change).style("color: var(--text-color)")
overlap_input = ui.number(label="Overlap",
value=config['overlap'], format='%.0f', max=6400, min=100, step=50) .on('change', on_config_change).style("color: var(--text-color)")
with ui.row():
num_search_result_input = ui.number(label="Results per Query",
value=config['num_search_result_per_query'], format='%.0f',
min=1, max=100, step=1) .on('change', on_config_change).style("color: var(--text-color)")
max_search_input = ui.number(label="Max Search Queries",
value=config['max_search'], format='%.0f', min=1, max=100, step=1) .on('change', on_config_change).style("color: var(--text-color)")
num_workers_input = ui.number(label="Number of Workers (leave empty for default)",
value=0, format='%.0f', min=0, max=32, step=1) .on('change', on_config_change).style("color: var(--text-color)")
config_section = config_section
config_section.visible = False
# --- Ergebnisse anzeigen ---
with ui.card().classes("w-full backdrop-blur-lg p-4 bg-white/10") as results_card:
ui.label("Research Results").classes("text-xl font-semibold mb-4")
with ui.tabs() as tabs:
ui.tab("Summary")
ui.tab("References")
ui.tab("SystemStates")
with ui.tab_panels(tabs, value="Summary").classes("w-full").style("background-color: var(--background-color)"):
with ui.tab_panel("Summary"):
summary_content = ui.markdown("").style("color : var(--text-color)")
with ui.tab_panel("References"):
references_content = ui.markdown("").style("color : var(--text-color)")
with ui.tab_panel("SystemStates"):
analysis_content = ui.markdown("").style("color : var(--text-color)")
# Ergebnisse sichtbar machen, sobald sie vorliegen.
results_card = results_card
results_card.visible = False
# --- Follow-Up Bereich mit mehrfachen Folgefragen und Suchparametern ---
with ui.card().classes("w-full backdrop-blur-lg bg-white/10 p-4 hidden") as followup_card:
pass
# Zugriff auf followup_card (falls später benötigt)
followup_card = followup_card
followup_card.visible = False
# --- Fortschrittsanzeige ---
with ui.card().classes("w-full backdrop-blur-lg bg-white/10 p-4") as progress_card:
with ui.row():
ui.label("Research Progress").classes("text-xl font-semibold mb-4")
query_length_label = ui.label("").classes("mt-6 hover:text-primary transition-colors duration-300")
time_label = ui.label("Time: ...").classes("mt-6 hover:text-primary transition-colors duration-300")
price_label = ui.label("Price: ...").classes(
"mt-6 hover:text-primary transition-colors duration-300")
overall_progress = ui.linear_progress(0).classes("w-full mb-4")
status_label = ui.label("Warte auf Start...").classes("text-base")
# Wir merken uns progress_card, falls wir ihn zurücksetzen wollen.
progress_card = progress_card
query_length_label = query_length_label
time_label = time_label
price_label = price_label
with ui.card().classes("w-full backdrop-blur-lg bg-white/10 p-4") as config_cart:
# --- Process Code Section ---
# --- Estimated Time and Price ---
# ui.label("History").classes("text-xl font-semibold mt-4 mb-2")
ui.label('Research History').classes('text-xl p-4')
show_history()
ui.button('Add Credits', on_click=lambda: balance_overlay(session_id)).props('icon=paid')
ui.label('About TruthSeeker').classes(
'mt-6 text-gray-500 hover:text-primary '
'transition-colors duration-300'
).on('click', lambda: ui.navigate.to('/open-Seeker.about', new_tab=True))
with ui.element('div').classes("w-full").style("white:100%; height:100%") as graph_ui:
pass
with ui.card().classes("w-full p-4").style("background-color: var(--background-color)"):
ui.label("Private Session link (restore the session on a different device)")
base_url = f'https://{os.getenv("HOSTNAME")}/gui/open-Seeker.seek' if not 'localhost' in os.getenv("HOSTNAME") else 'http://localhost:5000/gui/open-Seeker.seek'
ui.label(f"{base_url}?session_id={session_id}").style("white:100%")
ui.label("Changes each time!")
graph_ui = graph_ui
graph_ui.visible = False
main_ui = main_ui
main_ui.visible = False
# --- Hilfsfunktionen ---
def validate_inputs() -> bool:
if not query.value.strip():
with main_ui:
ui.notify("Bitte gib eine Forschungsfrage ein.", type="warning")
return False
return True
def reset_interface():
nonlocal overall_progress, status_label, results_card, followup_card
overall_progress.value = 0
with main_ui:
status_label.set_text("Research startet...")
# Ergebnisse und Follow-Up Bereich verstecken
results_card.visible = False
followup_card.visible = False
graph_ui.visible = False
def show_progress_indicators():
nonlocal progress_card
progress_card.visible = True
def update_results(data: dict, save=True):
nonlocal summary_content, analysis_content, references_content, results_card, followup_card,graph_ui, r_button, r_text, sr_button
with main_ui:
r_button.visible = True
r_text.set_text("Add to current Results or press 'Start new Research'")
sr_button.set_text("Add to current Results")
# Handle papers (1-to-1 case)
papers = data.get("papers", [])
if not isinstance(papers, list):
papers = [papers]
# Get insights
insights = data.get("insights", [])
if save:
history_entry = data.copy()
history_entry['papers'] = [paper.model_dump_json() for paper in papers]
if processor_instance is not None and processor_instance['instance'] is not None:
history_entry["mam_name"] = processor_instance['instance'].mem_name
history_entry["query"] = processor_instance['instance'].query
history_entry["processor_memory"] = processor_instance['instance'].tools.get_memory(
).save_memory(history_entry["mam_name"], None)
state['research_history'].append(history_entry)
save_user_state(session_id, state)
else:
papers = [Paper(**json.loads(paper)) for paper in papers]
create_followup_section(processor_instance, followup_card, session_id, balance)
with main_ui:
progress_card.visible = False
# Build summary from insights
summaries = []
for insight in insights:
if 'result' in insight and 'summary' in insight['result']:
if isinstance(insight['result']['summary'], str):
# print(insight['result']['summary'], "NEXT", json.loads(insight['result']['summary'][:-1]),"NEXT22", type(json.loads(insight['result']['summary'][:-1])))
insight['result']['summary'] = json.loads(insight['result']['summary'][:-1])
main_summary = insight['result']['summary'].get('main_summary', '')
if main_summary:
summaries.append(main_summary)
summary_text = "
".join(summaries) if summaries else "No summary available." summary_content.set_content(f"# Research Summary
{summary_text}")
# Analysis section (unchanged if processor details haven't changed)
if processor_instance["instance"] is not None:
inst = processor_instance["instance"]
analysis_md = (
f"# Analysis
" f"- query: {inst.query} " f"- chunk_size: {inst.chunk_size} " f"- overlap: {inst.overlap} " f"- max_workers: {inst.max_workers} " f"- num_search_result_per_query: {inst.nsrpq} " f"- max_search: {inst.max_search} " f"- download_dir: {inst.download_dir} " f"- mem_name: {inst.mem_name} " f"- current_session: {inst.current_session} " f"- all_ref_papers: {inst.all_ref_papers} " f"- all_texts_len: {inst.all_texts_len} " f"- final_texts_len: {inst.f_texts_len} " f"- num_workers: {inst.num_workers}" ) analysis_content.set_content(analysis_md)
# References and Insights section
references_md = "# References
" # Add papers references_md += " ".join( f"- ({i}) {getattr(paper, 'title', 'Unknown Title')}})" for i, paper in enumerate(papers) )
# Add detailed insights
references_md += "
Insights¶
" for i, insight in enumerate(insights): print(insight) result = insight.get('result', {}) summary = result.get('summary', {})
if isinstance(summary, str):
summary = json.loads(summary)
# Main summary
references_md += f"
Insight¶
" references_md += f"### Main Summary {summary.get('main_summary', 'No summary available.')} "
# Concept Analysis
concept_analysis = summary.get('concept_analysis', {})
if concept_analysis:
references_md += "
Concept Analysis¶
" references_md += "#### Key Concepts - " + " - ".join( concept_analysis.get('key_concepts', [])) + " " references_md += "
Relationships¶
- " + "
- ".join( concept_analysis.get('relationships', [])) + " " references_md += "
Importance Hierarchy¶
- " + "
-
".join( concept_analysis.get('importance_hierarchy', [])) + " "
# Topic Insights topic_insights = summary.get('topic_insights', {}) if topic_insights: references_md += "Topic Insights¶
" references_md += "#### Primary Topics - " + " - ".join( topic_insights.get('primary_topics', [])) + " " references_md += "
Cross References¶
- " + "
- ".join( topic_insights.get('cross_references', [])) + " " references_md += "
Knowledge Gaps¶
- " + "
-
".join( topic_insights.get('knowledge_gaps', [])) + " "
# Relevance Assessment relevance = summary.get('relevance_assessment', {}) if relevance: references_md += "Relevance Assessment¶
" references_md += f"- Query Alignment: {relevance.get('query_alignment', 'N/A')} " references_md += f"- Confidence Score: {relevance.get('confidence_score', 'N/A')} " references_md += f"- Coverage Analysis: {relevance.get('coverage_analysis', 'N/A')} "
references_content.set_content(references_md) # nx concpts graph if processor_instance["instance"] is not None: create_graph_tab( processor_instance, graph_ui,main_ui ) # Show results and followup cards results_card.visible = True followup_card.visible = True graph_ui.visible = Truedef load_history(index: int): entry = state['research_history'][index] if processor_instance is not None and processor_instance['instance'] is not None:
processor_instance["instance"].mem_name = entry["mam_name"] processor_instance['instance'].query = entry["query"] pass else: processor = Processor(entry["query"], tools=get_tools(), **config) # Setze den Callback so, dass Updates in der GUI angezeigt werden processor.callback = update_status processor.mem_name = entry["mam_name"] processor_instance["instance"] = processor processor_instance["instance"].tools.get_memory().load_memory(entry["mam_name"], entry["processor_memory"]) processor_instance["instance"].mem_name = entry["mam_name"] update_results(entry, save=False)
return helpr
--- Stripe Integration ---¶
def regiser_stripe_integration(is_scc=True): def stripe_callback(request: Request):
sid = request.row.query_params.get('session_id') if hasattr(request, 'row') else request.query_params.get('session_id')
state = get_user_state(sid)
if state['payment_id'] == '':
with ui.card().classes("w-full items-center").style("background-color: var(--background-color)"):
ui.label(f"No payment id!").classes("text-lg font-bold")
ui.button(
"Start Research",
on_click=lambda: ui.navigate.to("/open-Seeker.seek?session_id="+sid)
).classes(
"w-full px-6 py-4 text-lg font-bold "
"bg-primary hover:bg-primary-dark "
"transform hover:-translate-y-0.5 "
"transition-all duration-300 ease-in-out "
"rounded-xl shadow-lg animate-slideUp"
)
return
try:
session_data = stripe.checkout.Session.retrieve(state['payment_id'])
except Exception as e:
with ui.card().classes("w-full items-center").style("background-color: var(--background-color)"):
ui.label(f"No Transactions Details !{e}").classes("text-lg font-bold")
ui.button(
"Start Research",
on_click=lambda: ui.navigate.to("/open-Seeker.seek")
).classes(
"w-full px-6 py-4 text-lg font-bold "
"bg-primary hover:bg-primary-dark "
"transform hover:-translate-y-0.5 "
"transition-all duration-300 ease-in-out "
"rounded-xl shadow-lg animate-slideUp"
)
return
with ui.card().classes("w-full items-center").style("background-color: var(--background-color)"):
if is_scc and state['payment_id'] != '' and session_data.payment_status == 'paid':
state = get_user_state(sid)
amount = session_data.amount_total / 100 # Convert cents to euros
state['balance'] += amount
state['payment_id'] = ''
save_user_state(sid, state)
# ui.navigate.to(f'/session?session={session}')
ui.label(f"Transaction Complete - New balance :{state['balance']}").classes("text-lg font-bold")
with ui.card().classes("w-full p-4").style("background-color: var(--background-color)"):
ui.label("Private Session link (restore the session on a different device)")
base_url = f'https://{os.getenv("HOSTNAME")}/gui/open-Seeker.seek' if not 'localhost' in os.getenv("HOSTNAME")else 'http://localhost:5000/gui/open-Seeker.seek'
ui.label(f"{base_url}?session_id={sid}").style("white:100%")
ui.label("Changes each time!")
else:
ui.label(f"Transaction Error! {session_data}, {dir(session_data)}").classes("text-lg font-bold")
ui.button(
"Start Research",
on_click=lambda: ui.navigate.to("/open-Seeker.seek")
).classes(
"w-full px-6 py-4 text-lg font-bold "
"bg-primary hover:bg-primary-dark "
"transform hover:-translate-y-0.5 "
"transition-all duration-300 ease-in-out "
"rounded-xl shadow-lg animate-slideUp"
)
return stripe_callback
def handle_stripe_payment(amount: float, session_id): base_url = f'https://{os.getenv("HOSTNAME")}/gui/open-Seeker.stripe' if not 'localhost' in os.getenv("HOSTNAME") else 'http://localhost:5000/gui/open-Seeker.stripe' session = stripe.checkout.Session.create( payment_method_types=['card', "link", ], line_items=[{ 'price_data': { 'currency': 'eur', 'product_data': {'name': 'Research Credits'}, 'unit_amount': int(amount * 100), }, 'quantity': 1, }], automatic_tax={"enabled": True}, mode='payment', success_url=f'{base_url}?session_id={session_id}', cancel_url=f'{base_url}.error' ) state = get_user_state(session_id) state['payment_id'] = session.id save_user_state(session_id, state) ui.navigate.to(session.url, new_tab=True)
--- UI Components ---¶
def balance_overlay(session_id): with ui.dialog().classes('w-full max-w-md bg-white/20 backdrop-blur-lg rounded-xl') as dialog: with ui.card().classes('w-full p-6 space-y-4').style("background-color: var(--background-color)"): ui.label('Add Research Credits').classes('text-2xl font-bold') amount = ui.number('Amount (€) min 2', value=5, format='%.2f', min=2, max=9999, step=1).classes('w-full') with ui.row().classes('w-full justify-between'): ui.button('Cancel', on_click=dialog.close).props('flat') ui.button('Purchase', on_click=lambda: handle_stripe_payment(amount.value, session_id)) return dialog
def create_ui(processor): # ui_instance = register_nicegui("open-Seeker", create_landing_page , additional=""" """, show=False) register_nicegui("open-Seeker.demo", create_video_demo, additional=""" """, show=False)
newui
¶
cleanup_module(app)
¶
Cleanup resources when the module is unloaded
Source code in toolboxv2/mods/TruthSeeker/newui.py
1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | |
create_payment(app, data)
async
¶
Create a Stripe payment session
Source code in toolboxv2/mods/TruthSeeker/newui.py
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 | |
estimate_processing(data)
async
¶
Estimate processing time and cost for a given query
Source code in toolboxv2/mods/TruthSeeker/newui.py
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | |
follow_up_query(app, data)
async
¶
Ask a follow-up question about the research
Source code in toolboxv2/mods/TruthSeeker/newui.py
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | |
initialize_module(app)
¶
Initialize the module and register UI with CloudM
Source code in toolboxv2/mods/TruthSeeker/newui.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
payment_cancel(app, session_id, request_as_kwarg=True, request=None)
async
¶
Handle cancelled payment
Source code in toolboxv2/mods/TruthSeeker/newui.py
1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | |
payment_stream(app, session_id)
async
¶
SSE stream endpoint for payment status updates
Source code in toolboxv2/mods/TruthSeeker/newui.py
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | |
payment_success(app, session_id, request_as_kwarg=True, request=None)
async
¶
Handle successful payment
Source code in toolboxv2/mods/TruthSeeker/newui.py
1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 | |
research_results(app, research_id)
async
¶
Get the results of a completed research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | |
research_status(app, research_id)
async
¶
Get the status of a research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | |
start_research(app, data)
async
¶
Start a new research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | |
status_stream(app, research_id)
async
¶
SSE stream endpoint for research status updates
Source code in toolboxv2/mods/TruthSeeker/newui.py
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | |
stop_research(app, data)
async
¶
Stop a research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | |
tests
¶
TestTruthSeeker
¶
Bases: TestCase
Source code in toolboxv2/mods/TruthSeeker/tests.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
test_byCode_functionality()
¶
Test the byCode function
Source code in toolboxv2/mods/TruthSeeker/tests.py
337 338 339 340 341 342 343 344 | |
test_codes_invalid_promo()
async
¶
Test the codes function with invalid promo code
Source code in toolboxv2/mods/TruthSeeker/tests.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
test_codes_valid_request()
async
¶
Test the codes function with valid input
Source code in toolboxv2/mods/TruthSeeker/tests.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
test_process_invalid_key()
async
¶
Test the process function with invalid key
Source code in toolboxv2/mods/TruthSeeker/tests.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
test_process_valid_request()
async
¶
Test the process function with valid input
Source code in toolboxv2/mods/TruthSeeker/tests.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
test_start_initialization(mock_open, mock_join)
¶
Test the start function initializes correctly
Source code in toolboxv2/mods/TruthSeeker/tests.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
run_all_tests()
¶
Run all test classes
Source code in toolboxv2/mods/TruthSeeker/tests.py
393 394 395 396 | |
run_arxiv_processor_tests(test_name=None)
¶
Run TestArXivPDFProcessor tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
380 381 382 | |
run_pdf_downloader_tests(test_name=None)
¶
Run TestRobustPDFDownloader tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
375 376 377 | |
run_specific_test(test_class, test_name)
¶
Run a specific test from a test class
Source code in toolboxv2/mods/TruthSeeker/tests.py
389 390 391 | |
run_test_suite(test_class=None, test_name=None, verbosity=2)
¶
Run specific test class or test case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_class
|
The test class to run (optional) |
None
|
|
test_name
|
Specific test method name to run (optional) |
None
|
|
verbosity
|
Output detail level (default=2) |
2
|
Returns:
| Type | Description |
|---|---|
|
TestResult object |
Source code in toolboxv2/mods/TruthSeeker/tests.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
run_truth_seeker_tests(test_name=None)
¶
Run TestTruthSeeker tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
384 385 386 | |
test_arxiv_search()
¶
Run only ArXiv search tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
414 415 416 417 418 419 420 | |
test_pdf_download()
¶
Run only PDF download tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
398 399 400 401 402 403 404 | |
test_truth_seeker()
¶
Run only PDF download tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
406 407 408 409 410 411 412 | |
UltimateTTT
¶
UltimateTTTGameEngine
¶
Source code in toolboxv2/mods/UltimateTTT.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | |
WebSocketManager
¶
Tools
¶
Bases: MainTool
Production-ready WebSocketManager Tool.
Source code in toolboxv2/mods/WebSocketManager.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
broadcast_to_pool(pool_id, event, data)
async
¶
Broadcast message to all connections in a pool.
Source code in toolboxv2/mods/WebSocketManager.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
create_client(client_id)
¶
Create a WebSocket client.
Source code in toolboxv2/mods/WebSocketManager.py
511 512 513 514 515 | |
create_pool(pool_id)
¶
Create a standalone connection pool.
Source code in toolboxv2/mods/WebSocketManager.py
517 518 519 520 521 | |
create_server(host='localhost', port=8765, non_blocking=False)
async
¶
Create and start a WebSocket server.
Source code in toolboxv2/mods/WebSocketManager.py
499 500 501 502 503 504 505 506 507 508 509 | |
get_client(client_id)
¶
Get a client by ID.
Source code in toolboxv2/mods/WebSocketManager.py
615 616 617 | |
get_server_pool(pool_id)
¶
Get a server pool by ID.
Source code in toolboxv2/mods/WebSocketManager.py
611 612 613 | |
get_statistics()
¶
Get comprehensive statistics.
Source code in toolboxv2/mods/WebSocketManager.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
health_check()
async
¶
Perform comprehensive health check.
Source code in toolboxv2/mods/WebSocketManager.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
list_pools()
¶
List all connection pools with stats.
Source code in toolboxv2/mods/WebSocketManager.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
on_exit()
async
¶
Cleanup on exit.
Source code in toolboxv2/mods/WebSocketManager.py
481 482 483 484 485 486 487 488 489 490 491 492 493 | |
on_start()
¶
Initialize the WebSocketManager.
Source code in toolboxv2/mods/WebSocketManager.py
477 478 479 | |
show_version()
¶
Show current version.
Source code in toolboxv2/mods/WebSocketManager.py
495 496 497 | |
WebSocketClient
¶
Robust WebSocket client with automatic reconnection.
Source code in toolboxv2/mods/WebSocketManager.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
connect(server_url, timeout=30.0)
async
¶
Connect to WebSocket server.
Source code in toolboxv2/mods/WebSocketManager.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
disconnect()
async
¶
Gracefully disconnect.
Source code in toolboxv2/mods/WebSocketManager.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
register_handler(event, handler)
¶
Register a message handler for specific events.
Source code in toolboxv2/mods/WebSocketManager.py
244 245 246 247 | |
send_message(event, data)
async
¶
Send a message to the server.
Source code in toolboxv2/mods/WebSocketManager.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
WebSocketPool
¶
Manages a pool of WebSocket connections with actions and message routing.
Source code in toolboxv2/mods/WebSocketManager.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
add_connection(connection_id, websocket)
async
¶
Add a WebSocket connection to the pool.
Source code in toolboxv2/mods/WebSocketManager.py
68 69 70 71 | |
broadcast(message, exclude_connection=None)
async
¶
Broadcast message to all connections in the pool.
Source code in toolboxv2/mods/WebSocketManager.py
131 132 133 134 135 136 137 138 139 140 141 142 | |
close_all()
async
¶
Close all connections in the pool.
Source code in toolboxv2/mods/WebSocketManager.py
163 164 165 166 167 168 169 170 | |
get_connection_count()
¶
Get number of active connections.
Source code in toolboxv2/mods/WebSocketManager.py
159 160 161 | |
get_connection_ids()
¶
Get list of all connection IDs.
Source code in toolboxv2/mods/WebSocketManager.py
155 156 157 | |
handle_message(connection_id, message)
async
¶
Route incoming messages to appropriate handlers.
Source code in toolboxv2/mods/WebSocketManager.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
register_action(action_name, handler, connection_ids=None)
¶
Register an action handler for specific connections or globally.
Source code in toolboxv2/mods/WebSocketManager.py
79 80 81 82 83 84 85 86 87 88 89 90 | |
remove_connection(connection_id)
async
¶
Remove a WebSocket connection from the pool.
Source code in toolboxv2/mods/WebSocketManager.py
73 74 75 76 77 | |
send_to_connection(connection_id, message)
async
¶
Send message to a specific connection.
Source code in toolboxv2/mods/WebSocketManager.py
144 145 146 147 148 149 150 151 152 153 | |
WebSocketServer
¶
WebSocket server with pool management.
Source code in toolboxv2/mods/WebSocketManager.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
create_pool(pool_id)
¶
Create a new connection pool.
Source code in toolboxv2/mods/WebSocketManager.py
364 365 366 367 368 369 | |
get_pool(pool_id)
¶
Get an existing pool.
Source code in toolboxv2/mods/WebSocketManager.py
371 372 373 | |
handle_connection(websocket, path)
async
¶
Handle new WebSocket connections.
Source code in toolboxv2/mods/WebSocketManager.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
start(non_blocking=False)
async
¶
Start the WebSocket server.
Source code in toolboxv2/mods/WebSocketManager.py
410 411 412 413 414 415 416 417 418 | |
stop()
async
¶
Stop the server and close all connections.
Source code in toolboxv2/mods/WebSocketManager.py
420 421 422 423 424 425 426 427 428 429 430 431 | |
WhatsAppTb
¶
client
¶
DocumentSystem
¶
Source code in toolboxv2/mods/WhatsAppTb/client.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
delete_document(blob_id)
¶
Delete a document
Source code in toolboxv2/mods/WhatsAppTb/client.py
112 113 114 115 116 117 118 119 | |
list_documents(filter_type=None)
¶
List all documents with metadata
Source code in toolboxv2/mods/WhatsAppTb/client.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
save_document(file_data, filename, file_type)
¶
Save a document with metadata
Source code in toolboxv2/mods/WhatsAppTb/client.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
search_documents(query)
¶
Search documents by filename or content
Source code in toolboxv2/mods/WhatsAppTb/client.py
121 122 123 124 125 126 127 | |
WhatsAppAssistant
dataclass
¶
Source code in toolboxv2/mods/WhatsAppTb/client.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | |
agent_task(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
757 758 759 760 761 762 763 764 765 766 767 | |
check_emails(message, query='')
async
¶
Improved email checking with WhatsApp API formatting
Source code in toolboxv2/mods/WhatsAppTb/client.py
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | |
complete_authorization(message)
¶
Complete the authorization process using the authorization code
:param authorization_code: Authorization code received from Google
Source code in toolboxv2/mods/WhatsAppTb/client.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
delete_document(message)
async
¶
Delete document workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1426 1427 1428 1429 1430 1431 1432 1433 1434 | |
email_search(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
876 877 878 879 880 881 882 883 884 885 886 | |
email_summary(message)
async
¶
Generate AI-powered email summaries
Source code in toolboxv2/mods/WhatsAppTb/client.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | |
find_time_slot(message)
async
¶
Find and display the next 5 available time slots with dynamic durations
Source code in toolboxv2/mods/WhatsAppTb/client.py
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | |
generate_authorization_url(*a)
async
¶
Generate an authorization URL for user consent
:return: Authorization URL for the user to click and authorize access
Source code in toolboxv2/mods/WhatsAppTb/client.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
get_email_details(email_id)
async
¶
Retrieve and format full email details
Source code in toolboxv2/mods/WhatsAppTb/client.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | |
get_event_details(event_id)
async
¶
Retrieve and format calendar event details with location support
Source code in toolboxv2/mods/WhatsAppTb/client.py
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | |
handle_audio_message(message)
async
¶
Process audio messages with STT and TTS
Source code in toolboxv2/mods/WhatsAppTb/client.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
handle_button_interaction(content, message)
async
¶
Handle button click interactions
Source code in toolboxv2/mods/WhatsAppTb/client.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
handle_calendar_actions(message)
async
¶
Handle calendar-related pending actions
Source code in toolboxv2/mods/WhatsAppTb/client.py
1193 1194 1195 1196 1197 1198 1199 1200 | |
handle_email_actions(message)
async
¶
Handle multi-step email workflows
Source code in toolboxv2/mods/WhatsAppTb/client.py
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | |
handle_interactive(message)
async
¶
Handle all interactive messages
Source code in toolboxv2/mods/WhatsAppTb/client.py
533 534 535 536 537 538 539 | |
handle_media_message(message)
async
¶
Handle document/image/video uploads
Source code in toolboxv2/mods/WhatsAppTb/client.py
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | |
handle_message(message)
async
¶
Main message handler for incoming WhatsApp messages
Source code in toolboxv2/mods/WhatsAppTb/client.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
init_services()
¶
Initialize Gmail and Calendar services
Source code in toolboxv2/mods/WhatsAppTb/client.py
281 282 283 284 285 286 287 288 289 | |
load_credentials()
¶
Load previously saved credentials if available
:return: Whether credentials were successfully loaded
Source code in toolboxv2/mods/WhatsAppTb/client.py
267 268 269 270 271 272 273 274 275 276 277 278 | |
run()
¶
Start the WhatsApp assistant
Source code in toolboxv2/mods/WhatsAppTb/client.py
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 | |
save_credentials()
¶
Save the obtained credentials to a file for future use
Source code in toolboxv2/mods/WhatsAppTb/client.py
256 257 258 259 260 261 262 263 264 | |
search_documents(message)
async
¶
Initiate document search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1377 1378 1379 1380 1381 1382 1383 1384 | |
send_email(to, subject, body)
¶
Actual email sending function to be called by agent
Source code in toolboxv2/mods/WhatsAppTb/client.py
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | |
send_structured_response(result)
¶
Send complex responses using appropriate WhatsApp features
Source code in toolboxv2/mods/WhatsAppTb/client.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | |
setup_interaction_buttons()
¶
Define WhatsApp interaction buttons for different functionalities
Source code in toolboxv2/mods/WhatsAppTb/client.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
setup_progress_messengers()
¶
Initialize progress messengers for different types of tasks
Source code in toolboxv2/mods/WhatsAppTb/client.py
291 292 293 294 295 296 297 | |
show_task_stack(*a)
async
¶
Display current task stack
Source code in toolboxv2/mods/WhatsAppTb/client.py
1504 1505 1506 1507 1508 1509 | |
show_today_events(message)
async
¶
Show today's calendar events
Source code in toolboxv2/mods/WhatsAppTb/client.py
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | |
show_upcoming_events(message)
async
¶
Show upcoming events with interactive support
Source code in toolboxv2/mods/WhatsAppTb/client.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | |
start_agent(*a)
async
¶
Start the agent in background mode
Source code in toolboxv2/mods/WhatsAppTb/client.py
1490 1491 1492 1493 1494 1495 | |
start_document_upload(message)
async
¶
Initiate document upload workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1368 1369 1370 1371 1372 1373 1374 1375 | |
start_email_compose(message)
async
¶
Enhanced email composition workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
888 889 890 891 892 893 894 895 896 897 898 899 | |
start_event_create(message)
async
¶
Initiate event creation workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | |
stop_agent(*b)
async
¶
Stop the currently running agent
Source code in toolboxv2/mods/WhatsAppTb/client.py
1497 1498 1499 1500 1501 1502 | |
system_task(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
745 746 747 748 749 750 751 752 753 754 755 | |
server
¶
AppManager
¶
Source code in toolboxv2/mods/WhatsAppTb/server.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
add_instance(instance_id, **kwargs)
¶
Add a new app instance to the manager with automatic port assignment.
Source code in toolboxv2/mods/WhatsAppTb/server.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
add_update_instance(instance_id, token, phone_key, phone_number)
¶
Add or update instance configuration
Source code in toolboxv2/mods/WhatsAppTb/server.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
create_manager_ui(start_assistant)
¶
Enhanced WhatsApp Manager UI with instance configuration controls
Source code in toolboxv2/mods/WhatsAppTb/server.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_next_available_port()
¶
Find the next available port in the range.
Source code in toolboxv2/mods/WhatsAppTb/server.py
78 79 80 81 82 83 84 | |
on_event(instance_id, event)
async
¶
Handle events.
Source code in toolboxv2/mods/WhatsAppTb/server.py
156 157 158 159 160 | |
on_message(instance_id, message)
async
¶
Handle and forward incoming messages.
Source code in toolboxv2/mods/WhatsAppTb/server.py
150 151 152 153 154 | |
on_verification(instance_id, verification)
async
¶
Handle verification events.
Source code in toolboxv2/mods/WhatsAppTb/server.py
162 163 164 | |
restart_instance(instance_id)
¶
Safe restart of instance
Source code in toolboxv2/mods/WhatsAppTb/server.py
327 328 329 330 | |
run_all_instances()
¶
Start all instances in separate daemon threads.
Source code in toolboxv2/mods/WhatsAppTb/server.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
run_instance(instance_id)
¶
Run a single instance in a separate thread with error handling and automatic restart.
Source code in toolboxv2/mods/WhatsAppTb/server.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
signal_handler(signum, frame)
¶
Handle shutdown signals gracefully.
Source code in toolboxv2/mods/WhatsAppTb/server.py
181 182 183 184 185 | |
start_instance(instance_id)
¶
Start instance thread
Source code in toolboxv2/mods/WhatsAppTb/server.py
339 340 341 342 343 344 345 346 347 348 349 350 | |
stop_all_instances()
¶
Stop all running instances gracefully.
Source code in toolboxv2/mods/WhatsAppTb/server.py
187 188 189 190 191 192 193 | |
stop_instance(instance_id)
¶
Graceful stop of instance
Source code in toolboxv2/mods/WhatsAppTb/server.py
332 333 334 335 336 337 | |
update_instance_config(instance_id, new_key, new_number)
¶
Update existing instance configuration
Source code in toolboxv2/mods/WhatsAppTb/server.py
318 319 320 321 322 323 324 325 | |
utils
¶
ProgressMessenger
¶
Source code in toolboxv2/mods/WhatsAppTb/utils.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
send_initial_message(mode='progress')
¶
Sends the initial message. Modes can be 'progress' or 'loading'.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
start_loading_in_background(stop_flag)
¶
Starts the loading update in a separate thread.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
97 98 99 100 101 | |
start_progress_in_background(step_flag)
¶
Starts the progress update in a separate thread.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
91 92 93 94 95 | |
update_loading(stop_flag)
¶
Continuously updates the reaction to represent a looping 'loading' indicator.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
update_progress(step_flag)
¶
Updates the reaction on the message to represent progress.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
cli_functions
¶
replace_bracketed_content(text, replacements, inlist=False)
¶
Ersetzt Inhalte in eckigen Klammern mit entsprechenden Werten aus einem Wörterbuch.
:param text: Der zu verarbeitende Text als String. :param replacements: Ein Wörterbuch mit Schlüssel-Wert-Paaren für die Ersetzung. :return: Den modifizierten Text.
Source code in toolboxv2/mods/cli_functions.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
helper
¶
ToolBox V2 - CLI Helper Commands Provides CLI commands for user management with Clerk integration
create_invitation(app, username=None)
¶
[DEPRECATED] Invitations are not needed with Clerk. Users register directly via the web interface.
Source code in toolboxv2/mods/helper.py
316 317 318 319 320 321 322 323 324 325 326 327 328 | |
create_user(app, username=None, email=None)
¶
[DEPRECATED] Users are created via Clerk web registration. Use the web interface at /web/assets/signup.html
Source code in toolboxv2/mods/helper.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
delete_user_cli(app, user_id)
¶
Deletes a user from Clerk and local storage. Use 'list-users' to find the user ID.
Source code in toolboxv2/mods/helper.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
init_system(app)
async
¶
Initializes the ToolBoxV2 system. With Clerk, initial user creation happens via web registration. This command sets up the system configuration.
Source code in toolboxv2/mods/helper.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
list_users_cli(app)
¶
Lists all registered users from Clerk.
Source code in toolboxv2/mods/helper.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
login(app, email=None)
async
¶
Login to ToolBox V2 via Clerk Email + Code verification. No browser opening - direct code input in CLI.
Source code in toolboxv2/mods/helper.py
62 63 64 65 66 67 68 69 70 71 72 73 74 | |
logout(app)
async
¶
Logout from the current CLI session.
Source code in toolboxv2/mods/helper.py
77 78 79 80 81 82 83 84 85 | |
send_magic_link(app, username=None)
¶
[DEPRECATED] Magic links are replaced with email codes in Clerk Free Tier. Use 'tb login' for CLI authentication.
Source code in toolboxv2/mods/helper.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
status(app)
async
¶
Show current authentication status.
Source code in toolboxv2/mods/helper.py
88 89 90 91 92 93 94 95 96 | |
sync_data(app)
async
¶
Sync local user data with the server. This ensures settings and mod data are synchronized.
Source code in toolboxv2/mods/helper.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
update_settings(app, key, value)
async
¶
Update a user setting. Example: tb update-settings theme dark
Source code in toolboxv2/mods/helper.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
user_info(app)
async
¶
Show current user information.
Source code in toolboxv2/mods/helper.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
isaa
¶
CodingAgent
¶
AtomicCoder
¶
AtomicCoder V2 - Production-ready Code Generation System with LSP Integration
Architecture (inspired by ExecutionEngine): - AtomicCoderEngine: Main orchestration (like ExecutionEngine) - LSPManager: Unified LSP handling for Python, JS, HTML - CodeAnalyzer: Static analysis with AST + LSP diagnostics - SandboxExecutor: Safe code execution via MockIPython - SpecGenerator: Atomic specification generation - ValidationLoop: Test-driven validation with auto-fix
Key Innovation: Unified LSP Integration - Python: pylsp/jedi for completions, diagnostics, hover - JavaScript/TypeScript: ts-server for JS/TS analysis - HTML: Custom HTML analyzer with template support
Author: AtomicCoder V2 Version: 2.0.0
AtomBehavior
¶
Bases: BaseModel
Step 2: Behavior description
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
93 94 95 96 97 98 | |
AtomDependencies
¶
Bases: BaseModel
Step 4: Dependencies and imports
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
110 111 112 113 | |
AtomSignature
¶
Bases: BaseModel
Step 1: Basic signature - simple fields only
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
84 85 86 87 88 89 90 | |
AtomSpec
¶
Complete atomic specification - assembled from steps. NOT a Pydantic model to avoid complex nested validation.
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
generate_code_skeleton()
¶Generate code skeleton from spec
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
get_context_summary()
¶Build context string for next generation step
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
AtomTestCase
¶
Bases: BaseModel
Step 3: Single test case - generated one at a time
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
101 102 103 104 105 106 107 | |
AtomicCoderEngine
¶
Production-ready Atomic Coder with LSP Integration
Workflow: 1. ANALYSIS: Analyze file, gather context, detect language 2. SPEC_GENERATION: Generate atomic specification with tests 3. CODE_GENERATION: Generate implementation 4. LSP_VALIDATION: Validate with LSP diagnostics 5. TEST_EXECUTION: Run tests in sandbox 6. AUTO_FIX: If failed, attempt auto-fix (max 3 retries) 7. SYNC: Write final code to disk
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 | |
close()
async
¶Cleanup resources
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2182 2183 2184 2185 | |
execute(task, target_file, target_object, max_retries=3)
async
¶Main execution method - implements the atomic coding loop
Returns: (success, result_message)
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | |
execute_followup(task, target_file, target_object, previous_context=None, existing_tests=None, max_retries=3)
async
¶Execute a followup task with context from previous execution.
Use this for: - Iterating on failed implementations - Adding features to existing code - Running with pre-existing tests
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
Task description |
required |
target_file
|
str
|
Target file path |
required |
target_object
|
str
|
Function/class name |
required |
previous_context
|
dict | None
|
Dict with keys: code, errors, spec |
None
|
existing_tests
|
str | None
|
Pre-existing test code to use |
None
|
max_retries
|
int
|
Max retry attempts |
3
|
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 | |
execute_multi(tasks, parallel=False)
async
¶Execute multiple atomic coding tasks
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tasks
|
list[dict]
|
List of {"task", "target_file", "target_object"} dicts |
required |
parallel
|
bool
|
Whether to run in parallel |
False
|
Returns: List of (success, result) tuples
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 | |
get_execution_context(execution_id)
¶Get context from a previous execution for followup tasks.
Returns dict with: code, errors, spec, test_code
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 | |
get_state(execution_id)
¶Get execution state
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2165 2166 2167 | |
list_executions()
¶List all executions
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 | |
CodeAnalyzer
¶
Comprehensive code analyzer combining AST parsing with LSP diagnostics
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
analyze_file(file_path, content=None)
async
¶Analyze a file and build context
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
detect_language(file_path)
¶Detect language from file extension
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
697 698 699 700 701 702 703 704 705 706 707 708 709 | |
get_object_context(content, object_name, language)
¶Extract context for a specific object
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | |
validate_code(file_path, content)
async
¶Validate code using LSP diagnostics
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
CodeContext
¶
Bases: BaseModel
Context for code generation
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
218 219 220 221 222 223 224 225 | |
CoderPhase
¶
Bases: str, Enum
Current phase of atomic coding
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
49 50 51 52 53 54 55 56 57 58 59 | |
CoderState
dataclass
¶
State for atomic coding execution
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
to_dict()
¶Serialize state
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
DiagnosticSeverity
¶
Bases: str, Enum
LSP Diagnostic Severity
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
72 73 74 75 76 77 | |
LSPDiagnostic
¶
Bases: BaseModel
LSP Diagnostic result
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
197 198 199 200 201 202 203 204 205 206 | |
LSPManager
¶
Unified LSP Manager for Python, JavaScript, and HTML
Provides: - Diagnostics (errors, warnings) - Completions - Hover information - Go to definition - Code actions (auto-fix)
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
get_completions(file_path, content, line, column, language)
async
¶Get code completions
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
get_diagnostics(file_path, content, language)
async
¶Get diagnostics for a file
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
get_hover(file_path, content, line, column, language)
async
¶Get hover information for symbol
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
655 656 657 658 659 660 661 662 663 664 665 666 667 | |
shutdown()
async
¶Shutdown all LSP servers
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
669 670 671 672 673 674 675 676 677 678 679 680 681 | |
start_server(language)
async
¶Start LSP server for language
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
LSPServerConfig
dataclass
¶
Configuration for an LSP server
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
232 233 234 235 236 237 238 | |
LanguageType
¶
Bases: str, Enum
Supported language types
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
62 63 64 65 66 67 68 69 | |
SandboxExecutor
¶
Safe code execution environment using MockIPython-style isolation
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | |
modify_ast(file_path, object_name, new_code)
¶Modify specific object in file using AST
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | |
read_file(file_path)
¶Read file from workspace
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1013 1014 1015 1016 1017 1018 | |
reset()
¶Reset execution environment
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
904 905 906 907 908 909 910 911 | |
run_code(code, file_context=None)
async
¶Execute code safely and return (success, output)
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | |
run_tests(test_code, setup_code='')
async
¶Run test code and return validation result
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | |
write_file(file_path, content)
¶Write file to workspace
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
1006 1007 1008 1009 1010 1011 | |
ValidationResult
¶
Bases: BaseModel
Validation result from tests/LSP
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
209 210 211 212 213 214 215 | |
create_atomic_coder(agent, workspace_path, auto_lsp=True, verbose=True)
¶
Factory function to create AtomicCoderEngine
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 | |
main()
async
¶
Example usage of AtomicCoderEngine
Source code in toolboxv2/mods/isaa/CodingAgent/AtomicCoder.py
2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 | |
live
¶
AsyncCodeDetector
¶
Bases: NodeVisitor
Detect async code and top-level await
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
MockIPython
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |
__str__()
¶String representation of current session
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
890 891 892 893 894 895 896 897 898 899 900 901 | |
get_namespace()
¶Get current namespace
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
436 437 438 | |
load_session(name)
¶Load session with UTF-8 encoding
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 | |
modify_code(code=None, object_name=None, file=None)
async
¶Modify existing code in memory (user namespace) and optionally in the corresponding file.
This method updates variables, functions, or methods in the current Python session and can
also update the corresponding source file if specified.
Args:
code: New value or implementation for the object
object_name: Name of the object to modify (variable, function, or method)
file: Path to the file to update (if None, only updates in memory)
Returns:
String describing the modification result
Examples:
# 1. Update a variable in memory
await ipython.modify_code(code="5", object_name="x")
2. Change a method implementation¶
await ipython.modify_code( code='"""def sound(self): return "Woof""""', object_name="Dog.sound" )
3. Modify a function¶
await ipython.modify_code( code='"""def calculate_age(): return 25"""', object_name="calculate_age" )
4. Update variable in memory and file¶
await ipython.modify_code( code="100", object_name="MAX_SIZE", file="config.py" )
5. Modifying an attribute in init¶
await ipython.modify_code( code='"""def init(self): self.name = "Buddy""""', object_name="Dog.init" )
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | |
reset()
¶Reset the interpreter state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
run_cell(code, live_output=True)
async
¶Async version of run_cell that handles both sync and async code
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
save_session(name)
¶Save session with UTF-8 encoding
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | |
set_base_directory(path)
¶Set the base directory for the virtual file system and add it to sys.path for imports.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
New base directory path |
required |
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |
update_namespace(variables)
¶Update namespace with new variables
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
440 441 442 | |
ParentNodeTransformer
¶
Bases: NodeTransformer
Add parent references to AST nodes
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
255 256 257 258 259 260 | |
TeeStream
¶
Stream that writes to both console and buffer
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
ToolsInterface
¶
Minimalistic tools interface for LLMs providing code execution, virtual file system, and browser interaction capabilities.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 | |
__init__(session_dir=None, auto_remove=True, variables=None, variable_manager=None)
¶Initialize the tools interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str | None
|
Directory for session storage |
None
|
auto_remove
|
bool
|
Whether to auto-remove temporary files |
True
|
variables
|
dict[str, Any] | None
|
Initial variables dictionary |
None
|
variable_manager
|
Any | None
|
External variable manager instance |
None
|
web_llm
|
LLM model for web interactions |
required |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | |
clear_session()
async
¶Clear the current session (variables, history, files).
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | |
create_directory(dirpath)
async
¶Create a new directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dirpath
|
str
|
Path of directory to create |
required |
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | |
execute_python(code)
async
¶Execute Python code in the virtual environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Python code to execute |
required |
Returns:
| Type | Description |
|---|---|
str
|
Execution result as string |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | |
get_execution_history()
async
¶Get the execution history.
Returns:
| Type | Description |
|---|---|
str
|
Execution history as formatted string |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | |
get_tools(name=None)
¶Get all available tools as list of tuples (function, name, description).
Returns:
| Type | Description |
|---|---|
list[tuple[Any, str, str]]
|
List of tool tuples |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | |
get_variables()
async
¶Get current variables in JSON format.
Returns:
| Type | Description |
|---|---|
str
|
Variables as JSON string |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | |
install_package(package_name, version=None)
async
¶Install a Python package in the virtual environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
str
|
Name of the package to install |
required |
version
|
str | None
|
Optional specific version to install |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Installation result |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
list_directory(dirpath='.')
async
¶List contents of a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dirpath
|
str
|
Directory path to list |
'.'
|
Returns:
| Type | Description |
|---|---|
str
|
Directory listing as string |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | |
list_files(dirpath='.')
async
¶List files in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dirpath
|
str
|
Directory path to list |
'.'
|
Returns:
| Type | Description |
|---|---|
str
|
File listing as string |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | |
read_file(filepath, lines='')
async
¶Read content from a file in the virtual file system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the file |
required |
lines
|
str
|
Optional line range to read (e.g., "1-3" for lines 1 to 3) |
''
|
Returns:
| Type | Description |
|---|---|
str
|
File content or error message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | |
replace_in_file(filepath, old_content, new_content, precise=True)
async
¶Replace exact content in file with new content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the file |
required |
old_content
|
str
|
Exact content to replace (empty string for insertion at start) |
required |
new_content
|
str
|
Content to replace with |
required |
precise
|
bool
|
If True, requires exact match; if False, allows single occurrence replacement |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Success message or error |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | |
set_base_directory(path)
¶Set the base directory for the virtual file system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
New base directory path |
required |
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | |
set_current_file(filepath)
async
¶Set the current file for Python execution context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to set as current file |
required |
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | |
write_file(filepath, content, lines='')
async
¶Write content to a file in the virtual file system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the file |
required |
content
|
str
|
Content to write |
required |
lines
|
str
|
Optional line range to write (e.g., "1-3" for lines 1 to 3) |
''
|
Returns:
| Type | Description |
|---|---|
str
|
Success message |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | |
VirtualEnvContext
¶
Context manager for temporary virtual environment activation
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
VirtualFileSystem
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
change_directory(dirpath)
¶Change current working directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
132 133 134 135 136 137 | |
create_directory(dirpath)
¶Create a new directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
112 113 114 115 116 | |
delete_file(filepath)
¶Delete a virtual file
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
101 102 103 104 105 106 107 108 109 110 | |
ifile_exists(filepath)
¶Check if a file exists
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
39 40 41 42 | |
list_directory(dirpath='.')
¶List contents of a directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
125 126 127 128 129 130 | |
list_files(dirpath='.')
¶List files in a directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
118 119 120 121 122 123 | |
load_state(state_file)
¶Load virtual filesystem state from disk
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
157 158 159 160 161 162 163 164 165 | |
overwrite_lines(filepath, new_content, lines='')
¶Overwrite lines in a file
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
print_file_structure(start_path='.', indent='')
¶Print the file structure starting from the given path
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
read_file(filepath)
¶Read content from a virtual file using UTF-8
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
save_state(state_file)
¶Save virtual filesystem state to disk
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
148 149 150 151 152 153 154 155 | |
write_file(filepath, content)
¶Write content to a virtual file and persist to disk using UTF-8
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
auto_install(package_name, install_method='pip', upgrade=False, quiet=False, version=None, extra_args=None)
¶
Enhanced auto-save import with version and extra arguments support
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
project_developer
¶
ProjectDeveloperEngine V3 - Multi-File Code Generation System
Refactored from AtomicCoder with deep integration of the ToolBoxV2 ecosystem: - DocsSystem & ContextEngine (mkdocs.py): Project graph, semantic search, token-optimized context - DockerCodeExecutor / RestrictedPythonExecutor (executors.py): Safe code execution - FlowAgent & FlowAgentBuilder (flow_agent.py): LLM orchestration with chain patterns
State Machine Phases: 1. PHASE_ANALYSIS: Load context graph via DocsSystem.get_task_context() 2. PHASE_RESEARCH: MCP/Web search for external APIs/libraries 3. PHASE_MULTI_SPEC: Multi-file planning (Create/Modify operations) 4. PHASE_GENERATION: Iterative code generation with ContextBundle 5. PHASE_VALIDATION: LSP + Runtime validation with auto-fix loop
Author: ProjectDeveloper V3 Version: 3.0.0
DeveloperPhase
¶
Bases: str, Enum
Project development phases - State Machine States
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
111 112 113 114 115 116 117 118 119 120 121 122 | |
DeveloperState
dataclass
¶
Execution state for the ProjectDeveloperEngine
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
to_dict()
¶Serialize state to dictionary
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
DiagnosticSeverity
¶
Bases: str, Enum
Diagnostic severity levels
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
163 164 165 166 167 168 | |
FileAction
¶
Bases: BaseModel
Single file operation in the project spec
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
184 185 186 187 188 189 190 191 192 193 194 195 196 | |
FileActionType
¶
Bases: str, Enum
Types of file operations
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
125 126 127 128 129 130 | |
LSPDiagnostic
¶
Bases: BaseModel
LSP Diagnostic result
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
216 217 218 219 220 221 222 223 224 225 | |
LSPManager
¶
Unified LSP Manager for multi-language support
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
get_diagnostics(file_path, content, language)
async
¶Get diagnostics for a file
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
shutdown()
async
¶Shutdown all LSP servers
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
533 534 535 536 537 538 539 540 541 542 543 544 545 | |
start_server(language)
async
¶Start LSP server for language
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
LSPServerConfig
dataclass
¶
Configuration for an LSP server
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
292 293 294 295 296 297 298 | |
LanguageType
¶
Bases: str, Enum
Supported languages with file extensions
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
from_extension(ext)
classmethod
¶Detect language from file extension
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
ProjectDeveloperEngine
¶
Production-ready multi-file code generation engine.
Integrates: - DocsSystem for project context and dependency graphs - Safe executors (Docker/RestrictedPython) for validation - FlowAgent for LLM orchestration - LSP for static analysis
State Machine: IDLE -> ANALYSIS -> RESEARCH -> MULTI_SPEC -> GENERATION -> VALIDATION -> SYNC -> COMPLETED
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 | |
close()
async
¶Cleanup resources
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
1610 1611 1612 1613 | |
execute(task, target_files, max_retries=3, auto_research=True)
async
¶Main execution method - implements the multi-file development loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
Description of what to implement |
required |
target_files
|
List[str]
|
List of file paths to create/modify |
required |
max_retries
|
int
|
Maximum retry attempts per file |
3
|
auto_research
|
bool
|
Whether to auto-research unknown APIs |
True
|
Returns:
| Type | Description |
|---|---|
Tuple[bool, Dict[str, str]]
|
(success, generated_files_dict) |
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
get_state(execution_id)
¶Get execution state by ID
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
1593 1594 1595 | |
list_executions()
¶List all executions
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | |
ProjectSpec
¶
Bases: BaseModel
Complete project specification for multi-file development
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
ResearchResult
¶
Bases: BaseModel
Result from external research (MCP/Web)
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
175 176 177 178 179 180 181 | |
SafeExecutor
¶
Safe code execution wrapper using DockerCodeExecutor or RestrictedPythonExecutor. Automatically detects available executor and provides fallback.
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | |
execute(code, language=LanguageType.PYTHON)
async
¶Execute code safely and return results
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
run_tests(implementation, test_code)
async
¶Run tests against implementation
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
ValidationResult
¶
Bases: BaseModel
Validation result from LSP/Runtime tests
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
228 229 230 231 232 233 234 235 | |
create_project_developer(agent, workspace_path, docs_system=None, auto_lsp=True, prefer_docker=True, verbose=True)
¶
Factory function to create ProjectDeveloperEngine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
'FlowAgent'
|
FlowAgent instance for LLM interactions |
required |
workspace_path
|
Union[str, Path]
|
Path to project workspace |
required |
docs_system
|
Optional['DocsSystem']
|
Optional pre-initialized DocsSystem |
None
|
auto_lsp
|
bool
|
Whether to auto-start LSP servers |
True
|
prefer_docker
|
bool
|
Prefer Docker for code execution (safer) |
True
|
verbose
|
bool
|
Enable verbose logging |
True
|
Returns:
| Type | Description |
|---|---|
ProjectDeveloperEngine
|
Configured ProjectDeveloperEngine instance |
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | |
main()
async
¶
Example usage of ProjectDeveloperEngine
Source code in toolboxv2/mods/isaa/CodingAgent/project_developer.py
1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 | |
base
¶
Agent
¶
FlowAgent V2 - Production-ready Agent System
Components: - FlowAgent: Main agent class - AgentSession: Session-isolated context - SessionManager: Session lifecycle - ToolManager: Unified tool registry - CheckpointManager: State persistence - BindManager: Agent-to-agent binding - RuleSet: Dynamic skill/behavior system - ExecutionEngine: MAKER/RLM orchestration
Author: FlowAgent V2
AgentCheckpoint
dataclass
¶
Complete agent checkpoint data
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_summary()
¶Get human-readable summary
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
AgentModelData
¶
Bases: BaseModel
Source code in toolboxv2/mods/isaa/base/Agent/types.py
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | |
get_system_message()
¶Get system message with persona integration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
809 810 811 812 813 | |
AgentSession
¶
Session-isolated context encapsulating: - ChatSession for RAG and conversation history - VirtualFileSystem for token-efficient file management - RuleSet for situation-aware behavior - Tool restrictions per session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | |
__init__(session_id, agent_name, memory_instance, max_history=100, vfs_max_window_lines=250, rule_config_path=None, summarizer=None)
¶Initialize AgentSession.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Unique session identifier |
required |
agent_name
|
str
|
Name of the parent agent |
required |
memory_instance
|
Any
|
AISemanticMemory instance for ChatSession |
required |
max_history
|
int
|
Maximum conversation history length |
100
|
vfs_max_window_lines
|
int
|
Max lines to show per VFS file |
250
|
rule_config_path
|
str | None
|
Optional path to RuleSet config |
None
|
summarizer
|
Callable | None
|
Optional async function for VFS summaries |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
add_message(message, **kwargs)
async
¶Add message to conversation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
dict
|
Dict with 'role' and 'content' |
required |
**kwargs
|
Additional metadata for the message |
{}
|
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
707 708 709 710 711 712 713 714 715 716 717 718 | |
build_vfs_context()
¶Build VFS context for LLM
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
799 800 801 802 | |
cleanup()
async
¶Clean up resources
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
884 885 886 887 888 889 890 891 892 893 | |
clear_history()
¶Clear conversation history
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
701 702 703 704 705 | |
clear_situation()
¶Clear current situation
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
834 835 836 837 | |
close()
async
¶Close session - persist VFS and save state. Should be called when session ends.
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
confirm_suggestion()
¶Confirm pending situation suggestion
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
827 828 829 830 831 832 | |
from_checkpoint(data, memory_instance, summarizer=None)
async
classmethod
¶Restore session from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Checkpoint data |
required |
memory_instance
|
Any
|
AISemanticMemory instance |
required |
summarizer
|
Callable | None
|
Optional summarizer function |
None
|
Returns:
| Type | Description |
|---|---|
AgentSession
|
Restored AgentSession |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | |
get_current_rule_set()
¶Get current rule set state
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
808 809 810 | |
get_history(last_n=None)
¶Get conversation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
last_n
|
int | None
|
Number of recent messages (None = all) |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of message dicts |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
get_history_for_llm(last_n=10)
¶Get history formatted for LLM context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
last_n
|
int
|
Number of recent messages |
10
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of messages with role and content |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
753 754 755 756 757 758 759 760 761 762 763 764 765 | |
get_reference(text, concepts=False, **kwargs)
async
¶Query RAG for relevant context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Query text |
required |
**kwargs
|
Additional query parameters |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Relevant context string |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
get_restrictions()
¶Get all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
853 854 855 | |
get_stats()
¶Get session statistics
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
initialize()
async
¶Async initialization - must be called after init
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
is_tool_allowed(tool_name)
¶Check if tool is allowed in this session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
843 844 845 846 | |
reset_restrictions()
¶Reset all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
857 858 859 | |
rule_on_action(action, context=None)
¶Evaluate if action is allowed
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
812 813 814 815 | |
set_situation(situation, intent)
¶Set current situation and intent
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
817 818 819 820 821 | |
set_tool_restriction(tool_name, allowed)
¶Set tool restriction
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
848 849 850 851 | |
suggest_situation(situation, intent)
¶Suggest situation (agent confirms)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
823 824 825 | |
to_checkpoint()
¶Serialize session for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |
vfs_close(filename)
async
¶Close VFS file with summary
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
790 791 792 793 | |
vfs_create(filename, content='')
¶Create VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
771 772 773 774 | |
vfs_list()
¶List VFS files
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
795 796 797 | |
vfs_open(filename, line_start=1, line_end=-1)
¶Open VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
785 786 787 788 | |
vfs_read(filename)
¶Read VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
776 777 778 | |
vfs_write(filename, content)
¶Write VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
780 781 782 783 | |
BindConfig
dataclass
¶
Configuration for a binding
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |
BindManager
¶
Manages agent-to-agent bindings with live synchronization.
Modes: - Public: All bound agents share one sync file, everyone sees everything - Private: 1-to-1 bindings, each pair has separate sync file
Sync happens via VFS files that both agents can read/write.
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
__init__(agent)
¶Initialize BindManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent
|
Parent FlowAgent instance |
required |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
acknowledge_sync(entry_id, session_id='default')
async
¶Acknowledge a sync entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
str
|
Entry ID to acknowledge |
required |
session_id
|
str
|
Session for VFS |
'default'
|
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
bind(partner, mode='public', session_id='default')
async
¶Bind to another agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner
|
FlowAgent
|
Partner FlowAgent to bind with |
required |
mode
|
str
|
'public' (all see all) or 'private' (1-to-1) |
'public'
|
session_id
|
str
|
Session to use for sync file |
'default'
|
Returns:
| Type | Description |
|---|---|
BindConfig
|
BindConfig for this binding |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
from_checkpoint(data, partner_agents=None)
¶Restore bindings from checkpoint.
Note: This only restores binding configs. Actual partner references must be re-established by calling bind() again or providing partner_agents.
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
get_binding(partner_name)
¶Get binding for specific partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
453 454 455 | |
get_partner(partner_name)
¶Get partner agent reference (may be None if GC'd)
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
457 458 459 460 461 462 | |
get_stats()
¶Get binding statistics
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_sync_history(partner_name, last_n=20, session_id='default')
¶Get sync history with a partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
is_bound_to(partner_name)
¶Check if bound to partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
266 267 268 | |
list_bindings()
¶Get all bindings
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
449 450 451 | |
poll_sync(session_id='default')
async
¶Poll for new sync entries from all partners.
Returns:
| Type | Description |
|---|---|
dict[str, list[SyncEntry]]
|
Dict mapping partner_name -> list of new entries |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
read_sync(partner_name=None, since=None, unacknowledged_only=True, session_id='default')
async
¶Read sync entries from partners.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner_name
|
str | None
|
Specific partner (None = all) |
None
|
since
|
datetime | None
|
Only entries after this time |
None
|
unacknowledged_only
|
bool
|
Only unacknowledged entries |
True
|
session_id
|
str
|
Session for VFS |
'default'
|
Returns:
| Type | Description |
|---|---|
list[SyncEntry]
|
List of SyncEntry objects |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
to_checkpoint()
¶Serialize bindings for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
unbind(partner_name)
¶Unbind from a partner agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner_name
|
str
|
Name of partner to unbind |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if unbound successfully |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
unbind_all()
¶Unbind from all partners
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
261 262 263 264 | |
write_sync(action, data, target_partner=None, session_id='default')
async
¶Write sync entry for partners to read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
Action type ('message', 'tool_result', 'state_update') |
required |
data
|
Any
|
Data to sync |
required |
target_partner
|
str | None
|
Specific partner (None = all in public mode) |
None
|
session_id
|
str
|
Session for VFS |
'default'
|
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
CheckpointConfig
¶
Bases: BaseModel
Checkpoint configuration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
15 16 17 18 19 20 21 22 23 | |
CheckpointManager
¶
Manages agent checkpoints for persistence and recovery.
Features: - Auto-load latest checkpoint on init - Full state serialization - Checkpoint rotation (keep N newest)
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
__init__(agent, checkpoint_dir=None, auto_load=True, max_checkpoints=5, max_age_hours=168)
¶Initialize CheckpointManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent
|
Parent FlowAgent instance |
required |
checkpoint_dir
|
str | None
|
Directory for checkpoints (auto-detected if None) |
None
|
auto_load
|
bool
|
Auto-load latest checkpoint on init |
True
|
max_checkpoints
|
int
|
Maximum checkpoints to keep |
5
|
max_age_hours
|
int
|
Max age before auto-cleanup |
168
|
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
auto_restore(function_registry=None)
async
¶Auto-restore from latest checkpoint if available. Should be called after agent initialization.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Restoration statistics or empty dict if no checkpoint |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
cleanup_old(keep_count=None)
async
¶Delete old checkpoints, keeping newest N.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keep_count
|
int | None
|
Number to keep (uses max_checkpoints if None) |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Cleanup statistics |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
create()
async
¶Create checkpoint from current agent state.
Returns:
| Type | Description |
|---|---|
AgentCheckpoint
|
AgentCheckpoint with full state |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
delete_checkpoint(filename)
async
¶Delete a specific checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
512 513 514 515 516 517 518 519 520 521 522 523 | |
get_stats()
¶Get checkpoint manager statistics
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
list_checkpoints(max_age_hours=None)
¶List available checkpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_age_hours
|
int | None
|
Filter by max age (uses default if None) |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of checkpoint info dicts |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
load_latest()
async
¶Load the latest checkpoint.
Returns:
| Type | Description |
|---|---|
AgentCheckpoint | None
|
AgentCheckpoint or None if not found |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
restore(checkpoint=None, restore_sessions=True, restore_tools=True, restore_statistics=True, function_registry=None)
async
¶Restore agent state from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint | None
|
Checkpoint to restore (loads latest if None) |
None
|
restore_sessions
|
bool
|
Restore session data |
True
|
restore_tools
|
bool
|
Restore tool registry |
True
|
restore_statistics
|
bool
|
Restore statistics |
True
|
function_registry
|
dict[str, Callable] | None
|
Dict mapping tool names to functions |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Restoration statistics |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
save(checkpoint=None, filename=None)
async
¶Save checkpoint to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint | None
|
Checkpoint to save (creates new if None) |
None
|
filename
|
str | None
|
Custom filename (auto-generated if None) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Filepath of saved checkpoint |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
save_current()
async
¶Shortcut to create and save checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
270 271 272 | |
DecisionTask
dataclass
¶
Bases: Task
Task für dynamisches Routing
Source code in toolboxv2/mods/isaa/base/Agent/types.py
515 516 517 518 519 520 | |
ExecutionEngine
¶
ExecutionEngine V3 - Clean Architecture
Key improvements: 1. Strict ChatML history via ChatHistoryManager 2. Dynamic Tool Discovery - max 5 active tools 3. Dynamic Auto-Focus injection 4. Simplified single loop
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 | |
clear_focus(session_id)
¶Clear auto-focus for session
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1647 1648 1649 1650 | |
execute(query, session_id='default', config=None, **kwargs)
async
¶Main execution entry point.
This is the unified execution loop that replaces the complex phase-based state machine in V2.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | |
execute_stream(query, session_id='default', config=None, **kwargs)
async
¶Streaming execution - yields intermediate results.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | |
get_focus_context(session_id)
¶Get current auto-focus context
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1643 1644 1645 | |
get_state(execution_id)
¶Get execution state
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1639 1640 1641 | |
ExecutionResult
dataclass
¶
Result of execution
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
481 482 483 484 485 486 487 488 489 490 491 492 493 | |
ExecutionState
dataclass
¶
Execution state - simplified from V2
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
FlowAgent
¶
Production-ready autonomous agent with session isolation.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 | |
__mod__(other)
¶Implements % operator for conditional branching
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1983 1984 1985 | |
a_audio(audio, session_id='default', language='en', **kwargs)
async
¶Process a complete audio file/buffer through the agent.
This function handles the full pipeline: 1. Audio input (file, bytes, or path) 2. Understanding (STT or native audio model) 3. Processing (your agent logic via processor callback) 4. Response generation (TTS or native audio model)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio
|
Union[bytes, Path, str]
|
Audio input (bytes, file path, or Path object) |
required |
session_id
|
str
|
Session identifier |
'default'
|
language
|
str
|
Response language ("en", "de") |
'en'
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[bytes | None, str, list, dict]
|
Audio bytes for playback |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | |
a_run(query, session_id='default', execution_id=None, use_native_tools=True, human_online=False, intermediate_callback=None, human_response=None, max_iterations=15, token_budget=10000, **kwargs)
async
¶Main entry point for agent execution.
Architecture: MAKER (parallel decomposition) + RLM (VFS-based context)
Features: - Auto Intent Detection → Immediate/Tools/Decomposition - Category-based tool selection (max 5 tools) - RLM-VFS style ReAct loop - Parallel microagent execution for complex tasks - Pause/Continue support - Human-in-the-loop - Transaction-based rollback - Non-blocking learning
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
User query |
required |
session_id
|
str
|
Session identifier |
'default'
|
execution_id
|
str | None
|
For continuing paused execution |
None
|
use_native_tools
|
bool
|
LiteLLM native tool calling vs a_format_class |
True
|
human_online
|
bool
|
Allow human-in-the-loop |
False
|
intermediate_callback
|
Callable[[str], None] | None
|
User-facing status messages |
None
|
human_response
|
str | None
|
Response from human (for continuation) |
None
|
max_iterations
|
int
|
Max ReAct iterations (default 15) |
15
|
token_budget
|
int
|
Token budget per iteration (default 10000) |
10000
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Response string or special response for paused states: |
str
|
|
str
|
|
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
a_stream(query, session_id='default', execution_id=None, use_native_tools=True, human_online=False, intermediate_callback=None, human_response=None, max_iterations=15, token_budget=10000, **kwargs)
async
¶Main entry point for streaming agent execution.
Architecture: MAKER (parallel decomposition) + RLM (VFS-based context)
Features: - Auto Intent Detection → Immediate/Tools/Decomposition - Category-based tool selection (max 5 tools) - RLM-VFS style ReAct loop - Parallel microagent execution for complex tasks - Pause/Continue support - Human-in-the-loop - Transaction-based rollback - Non-blocking learning
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
User query |
required |
session_id
|
str
|
Session identifier |
'default'
|
execution_id
|
str | None
|
For continuing paused execution |
None
|
use_native_tools
|
bool
|
LiteLLM native tool calling vs a_format_class |
True
|
human_online
|
bool
|
Allow human-in-the-loop |
False
|
intermediate_callback
|
Callable[[str], None] | None
|
User-facing status messages |
None
|
human_response
|
str | None
|
Response from human (for continuation) |
None
|
max_iterations
|
int
|
Max ReAct iterations (default 15) |
15
|
token_budget
|
int
|
Token budget per iteration (default 10000) |
10000
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Response string or special response for paused states: |
str
|
|
str
|
|
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
a_stream_audio(audio_chunks, session_id='default', language='en', **kwargs)
async
¶Process a stream of audio chunks through the agent.
Use this for real-time audio processing where you want to yield audio output as soon as possible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_chunks
|
Generator[bytes, None, None]
|
Generator yielding audio byte chunks |
required |
session_id
|
str
|
Session identifier |
'default'
|
language
|
str
|
Response language ("en", "de") |
'en'
|
**kwargs
|
Additional options |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncGenerator[bytes, None]
|
Audio bytes chunks for immediate playback |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | |
add_tool(tool_func, name=None, description=None, category=None, flags=None)
async
¶Register a tool.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | |
bind(partner, mode='public', session_id='default')
async
¶Bind to another agent.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1895 1896 1897 | |
cancel_execution(execution_id)
async
¶Cancel an execution and rollback changes.
Returns:
| Type | Description |
|---|---|
bool
|
True if cancelled |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
602 603 604 605 606 607 608 609 610 611 612 | |
close()
async
¶Clean shutdown.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | |
context_overview(session_id=None, print_visual=True)
async
¶Analysiert den aktuellen Token-Verbrauch des Kontexts und gibt eine Übersicht zurück.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str | None
|
Die zu analysierende Session (oder None für generische Analyse) |
None
|
print_visual
|
bool
|
Ob eine grafische CLI-Anzeige ausgegeben werden soll |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Ein Dictionary mit den detaillierten Token-Metriken. |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | |
continue_execution(execution_id, human_response=None, **kwargs)
async
¶Continue a paused execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
execution_id
|
str
|
ID of paused execution |
required |
human_response
|
str | None
|
Response from human (if was waiting) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Response string |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
get_tool(name)
¶Get tool function by name.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
831 832 833 | |
init_session_tools(session)
¶Initialize session-specific tools for VFS V2, Docker, and filesystem operations.
Tools are categorized: - vfs: Virtual File System operations - docker: Container execution (flag: requires_docker) - filesystem: Real filesystem copy operations (flag: filesystem_access) - memory: RAG and history - situation: Behavior control
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |
list_executions()
¶List all active/paused executions.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
614 615 616 617 618 619 | |
pause_execution(execution_id)
async
¶Pause a running execution.
Returns:
| Type | Description |
|---|---|
dict | None
|
Execution state dict or None if not found |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
589 590 591 592 593 594 595 596 597 598 599 600 | |
restore(function_registry=None)
async
¶Restore from checkpoint.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1887 1888 1889 | |
save()
async
¶Save checkpoint.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1883 1884 1885 | |
unbind(partner_name)
¶Unbind from partner.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1899 1900 1901 | |
FormatConfig
dataclass
¶
Konfiguration für Response-Format und -Länge
Source code in toolboxv2/mods/isaa/base/Agent/types.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
get_combined_instructions()
¶Kombiniere Format- und Längen-Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
get_expected_word_range()
¶Erwartete Wortanzahl für Qualitätsbewertung
Source code in toolboxv2/mods/isaa/base/Agent/types.py
433 434 435 436 437 438 439 440 441 442 | |
get_format_instructions()
¶Generiere Format-spezifische Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_length_instructions()
¶Generiere Längen-spezifische Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
405 406 407 408 409 410 411 412 413 414 | |
LLMTask
dataclass
¶
Bases: Task
Spezialisierter Task für LLM-Aufrufe
Source code in toolboxv2/mods/isaa/base/Agent/types.py
492 493 494 495 496 497 498 499 500 501 502 | |
LearnedPattern
dataclass
¶
Patterns learned during runtime that provide helpful context.
Example
pattern: "Discord embeds require: title, description, color (hex format)" source_situation: "discord api work" confidence: 0.85
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
is_relevant_to(situation)
¶Check if pattern is relevant to situation
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
148 149 150 151 152 153 154 155 156 157 158 | |
use()
¶Mark pattern as used
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
160 161 162 163 164 165 | |
PersonaConfig
dataclass
¶
Source code in toolboxv2/mods/isaa/base/Agent/types.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | |
should_post_process()
¶Check if post-processing should be applied
Source code in toolboxv2/mods/isaa/base/Agent/types.py
784 785 786 | |
to_system_prompt_addition()
¶Convert persona to system prompt addition with format integration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
update_format(response_format, text_length, custom_instructions='')
¶Dynamische Format-Aktualisierung
Source code in toolboxv2/mods/isaa/base/Agent/types.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
ProgressEvent
dataclass
¶
Enhanced progress event with better error handling
Source code in toolboxv2/mods/isaa/base/Agent/types.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
from_dict(data)
classmethod
¶Create ProgressEvent from dictionary
Source code in toolboxv2/mods/isaa/base/Agent/types.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
get_chat_display_data()
¶Get data optimized for chat view display
Source code in toolboxv2/mods/isaa/base/Agent/types.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
get_detailed_display_data()
¶Get complete filtered data for detailed popup view
Source code in toolboxv2/mods/isaa/base/Agent/types.py
275 276 277 | |
get_progress_summary()
¶Get a brief summary for progress sidebar
Source code in toolboxv2/mods/isaa/base/Agent/types.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
to_dict()
¶Return event data with None values removed for compact display
Source code in toolboxv2/mods/isaa/base/Agent/types.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
ProgressTracker
¶
Advanced progress tracking with cost calculation and memory leak prevention
Source code in toolboxv2/mods/isaa/base/Agent/types.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
calculate_llm_cost(model, input_tokens, output_tokens, completion_response=None)
¶Calculate approximate LLM cost
Source code in toolboxv2/mods/isaa/base/Agent/types.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
emit_event(event)
async
¶Emit progress event with callback and storage (sliding window to prevent memory leak)
Source code in toolboxv2/mods/isaa/base/Agent/types.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
end_timer(key)
¶End timing operation and return duration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
338 339 340 341 342 343 344 | |
get_summary()
¶Get comprehensive progress summary
Source code in toolboxv2/mods/isaa/base/Agent/types.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
start_timer(key)
¶Start timing operation
Source code in toolboxv2/mods/isaa/base/Agent/types.py
332 333 334 335 336 | |
RuleResult
dataclass
¶
Result of rule evaluation for an action
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
168 169 170 171 172 173 174 175 176 177 | |
RuleSet
¶
Dynamic skill/behavior system that provides: - Tool grouping for cleaner agent context - Situation-aware instructions - Runtime learning capabilities - Live VFS integration
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
__init__(config_path=None, auto_sync_vfs=True)
¶Initialize RuleSet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | None
|
Path to YAML/JSON config file (optional) |
None
|
auto_sync_vfs
|
bool
|
Automatically mark dirty when changes occur |
True
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
activate_tool_group(group_name)
¶Mark a tool group as active
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
344 345 346 347 348 | |
add_rule(situation, intent, instructions, required_tool_groups=None, preconditions=None, postconditions=None, rule_id=None, learned=False, confidence=1.0)
¶Add a new situation rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
situation
|
str
|
Context description |
required |
intent
|
str
|
What user wants to achieve |
required |
instructions
|
list[str]
|
Step-by-step guidance |
required |
required_tool_groups
|
list[str] | None
|
Tool groups needed |
None
|
preconditions
|
list[str] | None
|
Conditions that must be true |
None
|
postconditions
|
list[str] | None
|
Expected results |
None
|
rule_id
|
str | None
|
Optional custom ID |
None
|
learned
|
bool
|
True if learned at runtime |
False
|
confidence
|
float
|
Initial confidence |
1.0
|
Returns:
| Type | Description |
|---|---|
SituationRule
|
Created SituationRule |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
build_vfs_content()
¶Build VFS file content for agent visibility. This is what the agent sees in the context window.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | |
clear_situation()
¶Clear current situation and intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
416 417 418 419 420 421 422 | |
confirm_suggestion()
¶Confirm pending suggestion and apply it
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
400 401 402 403 404 405 406 407 408 409 410 | |
deactivate_tool_group(group_name)
¶Mark a tool group as inactive
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
350 351 352 353 | |
expand_group(group_name)
¶Expand a tool group to its actual tool names. Used when agent decides to use a tool group.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
335 336 337 338 339 340 341 342 | |
from_checkpoint(data)
¶Restore from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
get_active_rules()
¶Get rules matching current situation/intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
526 527 528 529 530 531 | |
get_current_rule_set()
¶Get complete current rule set state. Used for inspection and debugging.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
get_groups_for_intent(intent)
¶Get tool groups that match the given intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
325 326 327 328 329 330 331 332 333 | |
get_relevant_patterns(situation=None, min_confidence=0.3, limit=10)
¶Get patterns relevant to the given or current situation.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
get_rule(rule_id)
¶Get rule by ID
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
499 500 501 | |
get_vfs_filename()
¶Get VFS filename for this rule set
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
789 790 791 | |
is_dirty()
¶Check if VFS content needs update
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
793 794 795 | |
learn_pattern(pattern, source_situation=None, confidence=0.5, category='general', tags=None)
¶Learn a new pattern from runtime experience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
The information learned |
required |
source_situation
|
str | None
|
Where it was learned (default: current) |
None
|
confidence
|
float
|
Initial confidence |
0.5
|
category
|
str
|
Pattern category |
'general'
|
tags
|
list[str] | None
|
Optional tags for matching |
None
|
Returns:
| Type | Description |
|---|---|
LearnedPattern
|
Created LearnedPattern |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
load_config(path)
¶Load configuration from YAML or JSON file.
Expected format:
tool_groups:
- name: discord_tools
display_name: Discord Server APIs
tool_names: [discord_send, discord_create, ...]
trigger_keywords: [discord, server, bot]
priority: 3
rules:
- situation: working on discord server api
intent: create welcome message
instructions:
- First gather info about message formatting
- Create draft and test once
- Ask human for validation
- Only after approval: save permanently
required_tool_groups: [discord_tools]
patterns:
- pattern: Discord embeds need title, description, color
category: api
confidence: 0.8
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
mark_clean()
¶Mark as synced with VFS
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
802 803 804 | |
match_rules(situation, intent, min_score=0.3)
¶Find rules that match the given situation and intent.
Returns list of matching rules sorted by match score.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
prune_low_confidence_patterns(threshold=0.2)
¶Remove patterns below confidence threshold. Returns count of removed patterns.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
record_rule_failure(rule_id)
¶Record failed rule application
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
543 544 545 546 547 | |
record_rule_success(rule_id)
¶Record successful rule application
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
537 538 539 540 541 | |
register_tool_group(name, display_name, tool_names, trigger_keywords, description='', priority=5, icon='🔧', auto_generated=False)
¶Register a new tool group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Internal name (e.g., "discord_tools") |
required |
display_name
|
str
|
Display name (e.g., "Discord Server APIs") |
required |
tool_names
|
list[str]
|
List of actual tool names in registry |
required |
trigger_keywords
|
list[str]
|
Keywords that activate this group |
required |
description
|
str
|
Short description |
''
|
priority
|
int
|
Sort priority (1=highest) |
5
|
icon
|
str
|
Display icon |
'🔧'
|
auto_generated
|
bool
|
True if from ToolManager category |
False
|
Returns:
| Type | Description |
|---|---|
ToolGroup
|
Created ToolGroup |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
register_tool_groups_from_categories(category_tools, category_descriptions=None)
¶Auto-generate tool groups from ToolManager categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_tools
|
dict[str, list[str]]
|
Dict mapping category -> list of tool names |
required |
category_descriptions
|
dict[str, str] | None
|
Optional descriptions per category |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
reject_suggestion()
¶Reject pending suggestion
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
412 413 414 | |
remove_rule(rule_id)
¶Remove a rule by ID
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
478 479 480 481 482 483 484 | |
rule_on_action(action, context=None)
¶Evaluate if an action is allowed based on current rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
The action being attempted (e.g., "save_permanent", "delete") |
required |
context
|
dict[str, Any] | None
|
Additional context (e.g., {"tool": "discord_save", "validated": False}) |
None
|
Returns:
| Type | Description |
|---|---|
RuleResult
|
RuleResult with allowed status and instructions |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
save_config(path)
¶Save current configuration to file
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | |
set_situation(situation, intent)
¶Set current situation and intent. This updates the VFS file and activates relevant tool groups.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
suggest_situation(situation, intent)
¶System suggests a situation/intent (L1: Hybrid approach). Agent must confirm before it takes effect.
Returns suggestion dict that can be confirmed or rejected.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
to_checkpoint()
¶Serialize for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | |
unregister_tool_group(name)
¶Remove a tool group
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
316 317 318 319 320 321 322 323 | |
update_rule(rule_id, **updates)
¶Update a rule's attributes
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
486 487 488 489 490 491 492 493 494 495 496 497 | |
SessionManager
¶
Manages all sessions for a FlowAgent instance.
Features: - Lazy loading of AISemanticMemory - Session creation/retrieval/cleanup - Auto-cleanup of inactive sessions - V2: Docker and LSP support
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
__init__(agent_name, default_max_history=100, vfs_max_window_lines=250, rule_config_path=None, summarizer=None, auto_cleanup_hours=None, enable_lsp=True, enable_docker=False, docker_config=None, toolboxv2_wheel_path=None)
¶Initialize SessionManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
str
|
Name of parent agent |
required |
default_max_history
|
int
|
Default history length for new sessions |
100
|
vfs_max_window_lines
|
int
|
Max VFS window lines |
250
|
rule_config_path
|
str | None
|
Default RuleSet config path |
None
|
summarizer
|
Callable | None
|
Summarizer function for VFS |
None
|
auto_cleanup_hours
|
float | None
|
Auto-cleanup sessions older than this |
None
|
enable_lsp
|
bool
|
Enable LSP for new sessions (default: True) |
True
|
enable_docker
|
bool
|
Enable Docker for new sessions (default: False) |
False
|
docker_config
|
DockerConfig | None
|
Docker configuration for new sessions |
None
|
toolboxv2_wheel_path
|
str | None
|
Path to ToolboxV2 wheel for Docker |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
cleanup_docker_containers()
async
¶Clean up all Docker containers from sessions.
Returns:
| Type | Description |
|---|---|
int
|
Number of containers destroyed |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
230 231 232 233 234 235 236 237 238 239 240 241 242 | |
cleanup_inactive(max_idle_hours=None)
async
¶Clean up sessions that have been idle too long.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_idle_hours
|
float | None
|
Max idle time (uses auto_cleanup_hours if None) |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of sessions cleaned up |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
close_all()
async
¶Close all sessions
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
182 183 184 185 | |
close_session(session_id)
async
¶Close and remove a session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Session to close |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if session was closed |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
exists(session_id)
¶Check if session exists
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
159 160 161 | |
from_checkpoint(data)
async
¶Restore sessions from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Checkpoint data |
required |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
get(session_id)
¶Get session by ID (None if not exists)
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
155 156 157 | |
get_all_active()
¶Get all active (initialized) sessions
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
195 196 197 | |
get_docker_sessions()
¶Get all sessions with Docker enabled
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
199 200 201 | |
get_or_create(session_id, max_history=None, rule_config_path=None, enable_lsp=None, enable_docker=None, docker_config=None)
async
¶Get existing session or create new one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Session identifier |
required |
max_history
|
int | None
|
Override default max history |
None
|
rule_config_path
|
str | None
|
Override default rule config |
None
|
enable_lsp
|
bool | None
|
Override default LSP setting |
None
|
enable_docker
|
bool | None
|
Override default Docker setting |
None
|
docker_config
|
DockerConfig | None
|
Override default Docker config |
None
|
Returns:
| Type | Description |
|---|---|
AgentSessionV2
|
AgentSessionV2 instance (initialized) |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
get_stats()
¶Get session manager statistics
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
list_sessions()
¶List all session IDs
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
187 188 189 | |
to_checkpoint()
¶Serialize all sessions for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
SituationRule
dataclass
¶
Defines behavior rules for specific situation + intent combinations.
Example
situation: "working on discord server api" intent: "create welcome message" instructions: [ "First gather info about message formatting requirements", "Create draft and test once in sandbox", "Ask human for validation before proceeding", "Only after explicit approval: save permanently" ]
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
matches(situation, intent)
¶Calculate match score for given situation and intent. Returns 0.0-1.0 match score.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
record_usage(success)
¶Record usage for learning
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
114 115 116 117 118 119 120 121 122 123 124 | |
SyncEntry
dataclass
¶
Single sync log entry
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
Task
dataclass
¶
Source code in toolboxv2/mods/isaa/base/Agent/types.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
__post_init__()
¶Ensure all mutable defaults are properly initialized
Source code in toolboxv2/mods/isaa/base/Agent/types.py
466 467 468 469 470 471 472 473 | |
ToolEntry
dataclass
¶
Unified tool entry supporting local functions, MCP tools, and A2A tools.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
__post_init__()
¶Ensure defaults and build schema
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
56 57 58 59 60 61 62 63 64 65 66 | |
has_category(category)
¶Check if tool belongs to category
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
106 107 108 | |
has_flag(flag_name)
¶Check if tool has a specific flag enabled
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
102 103 104 | |
matches_categories(categories)
¶Check if tool matches any of the given categories
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
110 111 112 | |
matches_flags(**flags)
¶Check if tool matches all given flag conditions
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
114 115 116 117 118 119 | |
record_call()
¶Record that this tool was called
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
97 98 99 100 | |
ToolGroup
dataclass
¶
Groups multiple tools under a single display name. Instead of showing 50 Discord tools, show "discord_tools: Discord Server APIs"
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
matches_intent(intent)
¶Check if this group matches the given intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
41 42 43 44 | |
to_display_line(active=False)
¶Generate display line for VFS
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
46 47 48 49 | |
ToolManager
¶
Unified tool registry managing local, MCP, and A2A tools.
Features: - Single registry for all tool types - Category and flag-based filtering - Native LiteLLM format support - Automatic RuleSet integration
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
__init__(rule_set=None)
¶Initialize ToolManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_set
|
RuleSet | None
|
Optional RuleSet for automatic tool group registration |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
count()
¶Get total number of registered tools
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
488 489 490 | |
execute(name, **kwargs)
async
¶Execute a tool by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Tool name |
required |
**kwargs
|
Arguments to pass to the tool |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
Tool execution result |
Raises:
| Type | Description |
|---|---|
ValueError
|
If tool not found |
RuntimeError
|
If tool has no function (MCP/A2A) |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
exists(name)
¶Check if tool exists
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
484 485 486 | |
export_for_display()
¶Export registry in human-readable format. Useful for debugging and status displays.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
from_checkpoint(data, function_registry=None)
¶Restore registry from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Checkpoint data |
required |
function_registry
|
dict[str, Callable] | None
|
Optional dict mapping tool names to functions (for restoring local tool functions) |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | |
get(name)
¶Get tool entry by name
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
412 413 414 | |
get_all()
¶Get all registered tools
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
472 473 474 | |
get_all_litellm(filter_categories=None, filter_flags=None, exclude_categories=None, max_tools=None)
¶Get all tools in LiteLLM format with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_categories
|
list[str] | None
|
Only include tools with these categories |
None
|
filter_flags
|
dict[str, bool] | None
|
Only include tools matching these flag conditions |
None
|
exclude_categories
|
list[str] | None
|
Exclude tools with these categories |
None
|
max_tools
|
int | None
|
Maximum number of tools to return |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of tool schemas in LiteLLM format |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
get_by_category(*categories)
¶Get tools matching any of the given categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*categories
|
str
|
Category names to match |
()
|
Returns:
| Type | Description |
|---|---|
list[ToolEntry]
|
List of matching ToolEntries |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
get_by_flags(**flags)
¶Get tools matching all given flag conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**flags
|
bool
|
Flag conditions (e.g., read=True, dangerous=False) |
{}
|
Returns:
| Type | Description |
|---|---|
list[ToolEntry]
|
List of matching ToolEntries |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
get_by_source(source)
¶Get tools by source (local, mcp, a2a)
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
466 467 468 469 470 | |
get_function(name)
¶Get tool function by name
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
416 417 418 419 | |
get_litellm_schema(name)
¶Get cached LiteLLM schema for a tool
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
508 509 510 511 512 513 | |
get_stats()
¶Get registry statistics
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
492 493 494 495 496 497 498 499 500 501 502 | |
list_categories()
¶Get list of all categories
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
480 481 482 | |
list_names()
¶Get list of all tool names
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
476 477 478 | |
register(func, name=None, description=None, category=None, flags=None, source='local', server_name=None, metadata=None, args_schema=None)
¶Register a tool in the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable | None
|
The callable function (can be None for MCP/A2A stubs) |
required |
name
|
str | None
|
Tool name (defaults to function name) |
None
|
description
|
str | None
|
Tool description (defaults to docstring) |
None
|
category
|
list[str] | str | None
|
Category or list of categories |
None
|
flags
|
dict[str, bool] | None
|
Dict of flags (read, write, dangerous, etc.) |
None
|
source
|
str
|
Tool source ('local', 'mcp', 'a2a') |
'local'
|
server_name
|
str | None
|
For MCP/A2A: the server name |
None
|
metadata
|
dict[str, Any] | None
|
Additional metadata |
None
|
args_schema
|
str | None
|
Override args schema string |
None
|
Returns:
| Type | Description |
|---|---|
ToolEntry
|
Created ToolEntry |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
register_a2a_tools(server_name, tools, category_prefix='a2a')
¶Register multiple A2A tools from a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_name
|
str
|
Name of the A2A server |
required |
tools
|
list[dict[str, Any]]
|
List of tool configs from A2A server |
required |
category_prefix
|
str
|
Prefix for category (default: "a2a") |
'a2a'
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
register_mcp_tools(server_name, tools, category_prefix='mcp')
¶Register multiple MCP tools from a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_name
|
str
|
Name of the MCP server |
required |
tools
|
list[dict[str, Any]]
|
List of tool configs from MCP server Each should have: name, description, inputSchema |
required |
category_prefix
|
str
|
Prefix for category (default: "mcp") |
'mcp'
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
set_ruleset(rule_set)
¶Set RuleSet for automatic tool group registration
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
826 827 828 829 830 | |
to_checkpoint()
¶Serialize registry for checkpoint. Note: Function references are NOT serialized.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | |
unregister(name)
¶Remove a tool from the registry
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
update(name, **updates)
¶Update a tool's attributes
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
ToolTask
dataclass
¶
Bases: Task
Spezialisierter Task für Tool-Aufrufe
Source code in toolboxv2/mods/isaa/base/Agent/types.py
505 506 507 508 509 510 511 512 | |
VFSFile
dataclass
¶
Represents a file in the Virtual File System.
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
26 27 28 29 30 31 32 33 34 35 36 37 | |
VirtualFileSystem
¶
Virtual File System for token-efficient context management.
Features: - open/closed states (only open files show in context) - Windowing (show only specific line ranges) - System files (read-only, auto-updated) - Auto-summary on close
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
append(filename, content)
¶Append to file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
143 144 145 146 147 148 149 150 151 152 153 154 | |
build_context_string()
¶Build VFS context string for LLM
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
close(filename)
async
¶Close file (create summary, remove from context)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
count_open_files()
¶Count currently open files (excluding system files)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
267 268 269 | |
create(filename, content='')
¶Create a new file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
115 116 117 118 119 120 121 122 | |
delete(filename)
¶Delete a file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
271 272 273 274 275 276 277 278 279 280 281 | |
delete_lines(filename, line_start, line_end)
¶Delete lines from file (1-indexed, inclusive)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
edit(filename, line_start, line_end, new_content)
¶Edit file by replacing lines (1-indexed)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
from_checkpoint(data)
¶Restore VFS from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
560 561 562 563 564 | |
get_file_info(filename)
¶Get file metadata without content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
insert_lines(filename, after_line, content)
¶Insert lines after specified line (1-indexed, 0 = at beginning)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
list_closed_with_summaries()
¶List closed files with their summaries
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
254 255 256 257 258 259 260 261 262 263 264 265 | |
list_files()
¶List all files with metadata
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
load_from_local(local_path, vfs_name=None, allowed_dirs=None, max_size_bytes=1024 * 1024)
¶Safely load a local file into VFS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_path
|
str
|
Path to local file |
required |
vfs_name
|
str | None
|
Name in VFS (default: basename of local_path) |
None
|
allowed_dirs
|
list[str] | None
|
List of allowed directories (security) |
None
|
max_size_bytes
|
int
|
Maximum file size to load |
1024 * 1024
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
open(filename, line_start=1, line_end=-1)
¶Open file (make content visible in context)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
read(filename)
¶Read file content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
124 125 126 127 128 | |
replace_text(filename, old_text, new_text, count=1)
¶Find and replace text in file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
save_to_local(vfs_name, local_path, allowed_dirs=None, overwrite=False, create_dirs=True)
¶Safely save a VFS file to local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vfs_name
|
str
|
Name of file in VFS |
required |
local_path
|
str
|
Destination path |
required |
allowed_dirs
|
list[str] | None
|
List of allowed directories (security) |
None
|
overwrite
|
bool
|
Allow overwriting existing files |
False
|
create_dirs
|
bool
|
Create parent directories if needed |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
set_rules_file(content)
¶Set the active_rules file content (from RuleSet)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
to_checkpoint()
¶Serialize VFS for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
548 549 550 551 552 553 554 555 556 557 558 | |
update_system_context()
¶Refresh system context
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
90 91 92 93 94 95 | |
view(filename, line_start=1, line_end=-1)
¶View/adjust visible window
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
write(filename, content)
¶Write/overwrite file content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
130 131 132 133 134 135 136 137 138 139 140 141 | |
create_default_ruleset(config_path=None)
¶
Create a RuleSet with sensible defaults.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | |
agent_session
¶
AgentSession - Session-isolated context for FlowAgent
Provides: - ChatSession integration for RAG and history - Session-specific VFS with RuleSet integration - Tool restrictions per session - Complete lifecycle management
Author: FlowAgent V2
AgentSession
¶Session-isolated context encapsulating: - ChatSession for RAG and conversation history - VirtualFileSystem for token-efficient file management - RuleSet for situation-aware behavior - Tool restrictions per session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | |
__init__(session_id, agent_name, memory_instance, max_history=100, vfs_max_window_lines=250, rule_config_path=None, summarizer=None)
¶Initialize AgentSession.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Unique session identifier |
required |
agent_name
|
str
|
Name of the parent agent |
required |
memory_instance
|
Any
|
AISemanticMemory instance for ChatSession |
required |
max_history
|
int
|
Maximum conversation history length |
100
|
vfs_max_window_lines
|
int
|
Max lines to show per VFS file |
250
|
rule_config_path
|
str | None
|
Optional path to RuleSet config |
None
|
summarizer
|
Callable | None
|
Optional async function for VFS summaries |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
add_message(message, **kwargs)
async
¶Add message to conversation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
dict
|
Dict with 'role' and 'content' |
required |
**kwargs
|
Additional metadata for the message |
{}
|
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
707 708 709 710 711 712 713 714 715 716 717 718 | |
build_vfs_context()
¶Build VFS context for LLM
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
799 800 801 802 | |
cleanup()
async
¶Clean up resources
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
884 885 886 887 888 889 890 891 892 893 | |
clear_history()
¶Clear conversation history
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
701 702 703 704 705 | |
clear_situation()
¶Clear current situation
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
834 835 836 837 | |
close()
async
¶Close session - persist VFS and save state. Should be called when session ends.
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
confirm_suggestion()
¶Confirm pending situation suggestion
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
827 828 829 830 831 832 | |
from_checkpoint(data, memory_instance, summarizer=None)
async
classmethod
¶Restore session from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Checkpoint data |
required |
memory_instance
|
Any
|
AISemanticMemory instance |
required |
summarizer
|
Callable | None
|
Optional summarizer function |
None
|
Returns:
| Type | Description |
|---|---|
AgentSession
|
Restored AgentSession |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | |
get_current_rule_set()
¶Get current rule set state
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
808 809 810 | |
get_history(last_n=None)
¶Get conversation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
last_n
|
int | None
|
Number of recent messages (None = all) |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of message dicts |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
get_history_for_llm(last_n=10)
¶Get history formatted for LLM context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
last_n
|
int
|
Number of recent messages |
10
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of messages with role and content |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
753 754 755 756 757 758 759 760 761 762 763 764 765 | |
get_reference(text, concepts=False, **kwargs)
async
¶Query RAG for relevant context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Query text |
required |
**kwargs
|
Additional query parameters |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Relevant context string |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
get_restrictions()
¶Get all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
853 854 855 | |
get_stats()
¶Get session statistics
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
initialize()
async
¶Async initialization - must be called after init
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
is_tool_allowed(tool_name)
¶Check if tool is allowed in this session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
843 844 845 846 | |
reset_restrictions()
¶Reset all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
857 858 859 | |
rule_on_action(action, context=None)
¶Evaluate if action is allowed
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
812 813 814 815 | |
set_situation(situation, intent)
¶Set current situation and intent
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
817 818 819 820 821 | |
set_tool_restriction(tool_name, allowed)
¶Set tool restriction
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
848 849 850 851 | |
suggest_situation(situation, intent)
¶Suggest situation (agent confirms)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
823 824 825 | |
to_checkpoint()
¶Serialize session for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |
vfs_close(filename)
async
¶Close VFS file with summary
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
790 791 792 793 | |
vfs_create(filename, content='')
¶Create VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
771 772 773 774 | |
vfs_list()
¶List VFS files
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
795 796 797 | |
vfs_open(filename, line_start=1, line_end=-1)
¶Open VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
785 786 787 788 | |
vfs_read(filename)
¶Read VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
776 777 778 | |
vfs_write(filename, content)
¶Write VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
780 781 782 783 | |
VFSFile
dataclass
¶Represents a file in the Virtual File System.
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
26 27 28 29 30 31 32 33 34 35 36 37 | |
VirtualFileSystem
¶Virtual File System for token-efficient context management.
Features: - open/closed states (only open files show in context) - Windowing (show only specific line ranges) - System files (read-only, auto-updated) - Auto-summary on close
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
append(filename, content)
¶Append to file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
143 144 145 146 147 148 149 150 151 152 153 154 | |
build_context_string()
¶Build VFS context string for LLM
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
close(filename)
async
¶Close file (create summary, remove from context)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
count_open_files()
¶Count currently open files (excluding system files)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
267 268 269 | |
create(filename, content='')
¶Create a new file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
115 116 117 118 119 120 121 122 | |
delete(filename)
¶Delete a file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
271 272 273 274 275 276 277 278 279 280 281 | |
delete_lines(filename, line_start, line_end)
¶Delete lines from file (1-indexed, inclusive)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
edit(filename, line_start, line_end, new_content)
¶Edit file by replacing lines (1-indexed)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
from_checkpoint(data)
¶Restore VFS from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
560 561 562 563 564 | |
get_file_info(filename)
¶Get file metadata without content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
insert_lines(filename, after_line, content)
¶Insert lines after specified line (1-indexed, 0 = at beginning)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
list_closed_with_summaries()
¶List closed files with their summaries
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
254 255 256 257 258 259 260 261 262 263 264 265 | |
list_files()
¶List all files with metadata
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
load_from_local(local_path, vfs_name=None, allowed_dirs=None, max_size_bytes=1024 * 1024)
¶Safely load a local file into VFS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_path
|
str
|
Path to local file |
required |
vfs_name
|
str | None
|
Name in VFS (default: basename of local_path) |
None
|
allowed_dirs
|
list[str] | None
|
List of allowed directories (security) |
None
|
max_size_bytes
|
int
|
Maximum file size to load |
1024 * 1024
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
open(filename, line_start=1, line_end=-1)
¶Open file (make content visible in context)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
read(filename)
¶Read file content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
124 125 126 127 128 | |
replace_text(filename, old_text, new_text, count=1)
¶Find and replace text in file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
save_to_local(vfs_name, local_path, allowed_dirs=None, overwrite=False, create_dirs=True)
¶Safely save a VFS file to local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vfs_name
|
str
|
Name of file in VFS |
required |
local_path
|
str
|
Destination path |
required |
allowed_dirs
|
list[str] | None
|
List of allowed directories (security) |
None
|
overwrite
|
bool
|
Allow overwriting existing files |
False
|
create_dirs
|
bool
|
Create parent directories if needed |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
set_rules_file(content)
¶Set the active_rules file content (from RuleSet)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
to_checkpoint()
¶Serialize VFS for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
548 549 550 551 552 553 554 555 556 557 558 | |
update_system_context()
¶Refresh system context
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
90 91 92 93 94 95 | |
view(filename, line_start=1, line_end=-1)
¶View/adjust visible window
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
write(filename, content)
¶Write/overwrite file content
Source code in toolboxv2/mods/isaa/base/Agent/agent_session.py
130 131 132 133 134 135 136 137 138 139 140 141 | |
agent_session_v2
¶
AgentSession V2 - Enhanced Session with VFS V2 and Docker Integration
Extends AgentSession with: - VirtualFileSystemV2 (directories, file types, LSP) - Docker execution environment - Web app display
Author: FlowAgent V2
AgentSessionV2
¶Enhanced AgentSession with VFS V2 and Docker integration.
Features: - VirtualFileSystemV2 with directories, file types, LSP - DockerVFS for isolated command execution - ChatSession integration for RAG and history - RuleSet for situation-aware behavior - Tool restrictions per session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | |
__init__(session_id, agent_name, memory_instance, max_history=100, vfs_max_window_lines=250, rule_config_path=None, summarizer=None, enable_lsp=True, enable_docker=False, docker_config=None, toolboxv2_wheel_path=None)
¶Initialize AgentSessionV2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Unique session identifier |
required |
agent_name
|
str
|
Name of the parent agent |
required |
memory_instance
|
Any
|
AISemanticMemory instance for ChatSession |
required |
max_history
|
int
|
Maximum conversation history length |
100
|
vfs_max_window_lines
|
int
|
Max lines to show per VFS file |
250
|
rule_config_path
|
str | None
|
Optional path to RuleSet config |
None
|
summarizer
|
Callable | None
|
Optional async function for VFS summaries |
None
|
enable_lsp
|
bool
|
Enable LSP integration for code diagnostics |
True
|
enable_docker
|
bool
|
Enable Docker execution environment |
False
|
docker_config
|
DockerConfig | None
|
Docker configuration |
None
|
toolboxv2_wheel_path
|
str | None
|
Path to ToolboxV2 wheel for Docker |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
add_message(message, **kwargs)
async
¶Add message to conversation history
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
204 205 206 207 208 | |
build_vfs_context()
¶Build VFS context for LLM
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
285 286 287 288 | |
cleanup()
async
¶Clean up resources
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
434 435 436 437 438 439 440 441 442 443 444 445 | |
clear_history()
¶Clear conversation history
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
198 199 200 201 202 | |
clear_situation()
¶Clear current situation
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
380 381 382 383 | |
close()
async
¶Close session - persist VFS and save state
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
confirm_suggestion()
¶Confirm pending situation suggestion
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
373 374 375 376 377 378 | |
docker_get_logs(lines=100)
async
¶Get web app logs
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
338 339 340 341 342 | |
docker_run_command(command, timeout=300, sync_before=True, sync_after=True)
async
¶Run a command in the Docker container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command to execute |
required |
timeout
|
int
|
Command timeout in seconds |
300
|
sync_before
|
bool
|
Sync VFS to container before execution |
True
|
sync_after
|
bool
|
Sync container to VFS after execution |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with stdout, stderr, exit_code |
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
docker_start_web_app(entrypoint, port=8080, env=None)
async
¶Start a web app in the Docker container
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
319 320 321 322 323 324 325 326 327 328 329 330 | |
docker_status()
¶Get Docker container status
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
344 345 346 347 348 | |
docker_stop_web_app()
async
¶Stop running web app
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
332 333 334 335 336 | |
from_checkpoint(data, memory_instance, summarizer=None, docker_config=None)
async
classmethod
¶Restore session from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
get_current_rule_set()
¶Get current rule set state
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
354 355 356 | |
get_history(last_n=None)
¶Get conversation history
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
218 219 220 221 222 223 | |
get_history_for_llm(last_n=10)
¶Get history formatted for LLM context
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
225 226 227 228 | |
get_reference(text, concepts=False, **kwargs)
async
¶Query RAG for relevant context
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
210 211 212 213 214 215 216 | |
get_restrictions()
¶Get all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
398 399 400 | |
get_stats()
¶Get session statistics
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
initialize()
async
¶Async initialization - must be called after init
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
is_tool_allowed(tool_name)
¶Check if tool is allowed in this session
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
389 390 391 | |
reset_restrictions()
¶Reset all tool restrictions
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
402 403 404 | |
rule_on_action(action, context=None)
¶Evaluate if action is allowed
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
358 359 360 361 | |
set_situation(situation, intent)
¶Set current situation and intent
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
363 364 365 366 367 | |
set_tool_restriction(tool_name, allowed)
¶Set tool restriction
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
393 394 395 396 | |
suggest_situation(situation, intent)
¶Suggest situation (agent confirms)
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
369 370 371 | |
to_checkpoint()
¶Serialize session for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
vfs_close(path)
async
¶Close VFS file with summary
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
253 254 255 256 | |
vfs_create(path, content='')
¶Create VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
234 235 236 237 | |
vfs_diagnostics(path)
async
¶Get LSP diagnostics for a file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
281 282 283 | |
vfs_list()
¶List VFS files
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
258 259 260 | |
vfs_ls(path='/', recursive=False)
¶List directory contents
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
277 278 279 | |
vfs_mkdir(path, parents=False)
¶Create directory
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
262 263 264 265 | |
vfs_mv(source, destination)
¶Move/rename file or directory
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
272 273 274 275 | |
vfs_open(path, line_start=1, line_end=-1)
¶Open VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
248 249 250 251 | |
vfs_read(path)
¶Read VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
239 240 241 | |
vfs_rmdir(path, force=False)
¶Remove directory
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
267 268 269 270 | |
vfs_write(path, content)
¶Write VFS file
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
243 244 245 246 | |
retrieval_to_llm_context_compact(data, max_entries=5)
¶Format retrieval results for LLM context
Source code in toolboxv2/mods/isaa/base/Agent/agent_session_v2.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
bind_manager
¶
BindManager - Agent binding with live-sync via VFS
Provides: - Public mode: All bound agents share one sync file - Private mode: 1-to-1 bindings with separate sync files - Live synchronization between agents
Author: FlowAgent V2
BindConfig
dataclass
¶Configuration for a binding
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |
BindManager
¶Manages agent-to-agent bindings with live synchronization.
Modes: - Public: All bound agents share one sync file, everyone sees everything - Private: 1-to-1 bindings, each pair has separate sync file
Sync happens via VFS files that both agents can read/write.
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
__init__(agent)
¶Initialize BindManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent
|
Parent FlowAgent instance |
required |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
acknowledge_sync(entry_id, session_id='default')
async
¶Acknowledge a sync entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
str
|
Entry ID to acknowledge |
required |
session_id
|
str
|
Session for VFS |
'default'
|
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
bind(partner, mode='public', session_id='default')
async
¶Bind to another agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner
|
FlowAgent
|
Partner FlowAgent to bind with |
required |
mode
|
str
|
'public' (all see all) or 'private' (1-to-1) |
'public'
|
session_id
|
str
|
Session to use for sync file |
'default'
|
Returns:
| Type | Description |
|---|---|
BindConfig
|
BindConfig for this binding |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
from_checkpoint(data, partner_agents=None)
¶Restore bindings from checkpoint.
Note: This only restores binding configs. Actual partner references must be re-established by calling bind() again or providing partner_agents.
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
get_binding(partner_name)
¶Get binding for specific partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
453 454 455 | |
get_partner(partner_name)
¶Get partner agent reference (may be None if GC'd)
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
457 458 459 460 461 462 | |
get_stats()
¶Get binding statistics
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_sync_history(partner_name, last_n=20, session_id='default')
¶Get sync history with a partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
is_bound_to(partner_name)
¶Check if bound to partner
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
266 267 268 | |
list_bindings()
¶Get all bindings
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
449 450 451 | |
poll_sync(session_id='default')
async
¶Poll for new sync entries from all partners.
Returns:
| Type | Description |
|---|---|
dict[str, list[SyncEntry]]
|
Dict mapping partner_name -> list of new entries |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
read_sync(partner_name=None, since=None, unacknowledged_only=True, session_id='default')
async
¶Read sync entries from partners.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner_name
|
str | None
|
Specific partner (None = all) |
None
|
since
|
datetime | None
|
Only entries after this time |
None
|
unacknowledged_only
|
bool
|
Only unacknowledged entries |
True
|
session_id
|
str
|
Session for VFS |
'default'
|
Returns:
| Type | Description |
|---|---|
list[SyncEntry]
|
List of SyncEntry objects |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
to_checkpoint()
¶Serialize bindings for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
unbind(partner_name)
¶Unbind from a partner agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partner_name
|
str
|
Name of partner to unbind |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if unbound successfully |
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
unbind_all()
¶Unbind from all partners
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
261 262 263 264 | |
write_sync(action, data, target_partner=None, session_id='default')
async
¶Write sync entry for partners to read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
Action type ('message', 'tool_result', 'state_update') |
required |
data
|
Any
|
Data to sync |
required |
target_partner
|
str | None
|
Specific partner (None = all in public mode) |
None
|
session_id
|
str
|
Session for VFS |
'default'
|
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
SyncEntry
dataclass
¶Single sync log entry
Source code in toolboxv2/mods/isaa/base/Agent/bind_manager.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
builder
¶
FlowAgentBuilder V2 - Production-ready Builder for FlowAgent
Refactored to work with the new FlowAgent architecture: - VFS-based context management - RuleSet integration for persona/behavior - Unified ToolManager - IntelligentRateLimiter integration - MCP Session Management
Author: FlowAgent V2
A2AConfig
¶
Bases: BaseModel
A2A server configuration
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
86 87 88 89 90 91 92 93 94 95 96 | |
AgentConfig
¶
Bases: BaseModel
Complete agent configuration for loading/saving
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
FlowAgentBuilder
¶Production-ready FlowAgent builder for the V2 architecture.
Features: - Fluent API for configuration - MCP integration with automatic tool categorization - Persona → RuleSet integration - World Model → VFS file - IntelligentRateLimiter configuration - Checkpoint management
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | |
__init__(config=None, config_path=None)
¶Initialize builder with configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
AgentConfig
|
AgentConfig object |
None
|
config_path
|
str
|
Path to YAML/JSON config file |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
add_api_key(provider, key)
¶Add an API key for rate limiter key rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name (e.g., "vertex_ai", "openai", "anthropic") |
required |
key
|
str
|
The API key |
required |
Example
.add_api_key("vertex_ai", "AIza...") .add_api_key("openai", "sk-...")
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
add_fallback_chain(primary_model, fallback_models)
¶Add a model fallback chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
primary_model
|
str
|
Primary model (e.g., "vertex_ai/gemini-2.5-pro") |
required |
fallback_models
|
list[str]
|
List of fallback models in priority order |
required |
Example
.add_fallback_chain( "vertex_ai/gemini-2.5-pro", ["vertex_ai/gemini-2.5-flash", "vertex_ai/gemini-2.0-flash"] )
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
add_persona_profile(profile_name, name, style='professional', tone='friendly', personality_traits=None, custom_instructions='', response_format=None, text_length=None)
¶Add a persona profile.
Persona information is written to VFS system_context and creates learned patterns in RuleSet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_name
|
str
|
Internal profile name |
required |
name
|
str
|
Display name for the persona |
required |
style
|
str
|
Communication style |
'professional'
|
tone
|
str
|
Tone of responses |
'friendly'
|
personality_traits
|
list[str]
|
List of personality traits |
None
|
custom_instructions
|
str
|
Additional instructions |
''
|
response_format
|
str
|
Response format preference |
None
|
text_length
|
str
|
Text length preference |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | |
add_tool(func, name=None, description=None, category=None, flags=None)
¶Add custom tool function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
The tool function |
required |
name
|
str
|
Tool name (defaults to function name) |
None
|
description
|
str
|
Tool description (defaults to docstring) |
None
|
category
|
list[str] | str
|
Category or list of categories for RuleSet grouping |
None
|
flags
|
dict[str, bool]
|
Dictionary of flags (e.g., {"dangerous": True}) |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |
add_tools_from_module(module, prefix='', category=None, exclude=None)
¶Add all functions from a module as tools
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |
add_world_fact(key, value)
¶Add a single world fact
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
334 335 336 337 | |
build()
async
¶Build the production-ready FlowAgent.
Steps: 1. Setup API configuration 2. Create PersonaConfig 3. Create AgentModelData 4. Create FlowAgent instance 5. Add custom variables to VFS 6. Add custom tools 7. Process MCP configuration (load tools, categorize) 8. Add MCP tools to ToolManager 9. Setup MCP server 10. Setup A2A server 11. Apply persona to RuleSet 12. Restore checkpoint if enabled
Returns:
| Type | Description |
|---|---|
FlowAgent
|
Configured FlowAgent instance |
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
create_analyst_agent(name='AnalystAgent')
classmethod
¶Create a pre-configured data analyst agent
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1291 1292 1293 1294 1295 1296 1297 1298 | |
create_creative_agent(name='CreativeAgent')
classmethod
¶Create a creative assistant agent
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1318 1319 1320 1321 1322 1323 1324 1325 | |
create_developer_agent(name='DeveloperAgent', with_mcp=True, with_a2a=False)
classmethod
¶Create a pre-configured developer agent
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | |
create_executive_agent(name='ExecutiveAgent', with_integrations=True)
classmethod
¶Create an executive assistant agent
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | |
create_general_assistant(name='AssistantAgent', full_integration=True)
classmethod
¶Create a general-purpose assistant with full integration
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | |
enable_a2a_server(host='0.0.0.0', port=5000, agent_name=None, agent_description=None)
¶Enable A2A server for agent-to-agent communication
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
enable_mcp_server(host='0.0.0.0', port=8000, server_name=None)
¶Enable MCP server
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
from_config_file(config_path)
classmethod
¶Create builder from configuration file
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
250 251 252 253 | |
load_mcp_tools_from_config(config_path)
¶Load MCP tools from configuration.
The builder will: 1. Initialize MCPSessionManager 2. Connect to MCP servers 3. Extract all capabilities (tools, resources, prompts) 4. Register tools in ToolManager with categories 5. Create RuleSet tool groups automatically
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | dict
|
Path to MCP config file or config dict |
required |
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | |
load_rate_limiter_config(config_path)
¶Load rate limiter configuration from file.
Expected format:
{
"features": {
"rate_limiting": true,
"model_fallback": true,
"key_rotation": true,
"key_rotation_mode": "balance"
},
"api_keys": {
"vertex_ai": ["key1", "key2"],
"openai": ["sk-..."]
},
"fallback_chains": {
"vertex_ai/gemini-2.5-pro": ["vertex_ai/gemini-2.5-flash"]
},
"limits": {
"vertex_ai/gemini-2.5-pro": {"rpm": 2, "input_tpm": 32000}
}
}
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
save_config(config_path, format='yaml')
¶Save current configuration to file
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
set_active_persona(profile_name)
¶Set active persona profile
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
746 747 748 749 750 751 752 753 | |
set_model_limits(model, rpm=None, tpm=None, input_tpm=None, is_free_tier=False)
¶Set custom rate limits for a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Model string (e.g., "vertex_ai/gemini-2.5-pro") |
required |
rpm
|
int
|
Requests per minute |
None
|
tpm
|
int
|
Tokens per minute |
None
|
input_tpm
|
int
|
Input tokens per minute |
None
|
is_free_tier
|
bool
|
Whether this is a free tier model |
False
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
validate_config()
¶Validate the current configuration
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | |
verbose(enable=True)
¶Enable verbose logging
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
293 294 295 296 297 298 | |
with_analyst_persona(name='Data Analyst')
¶Add and set pre-built analyst persona
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
771 772 773 774 775 776 777 778 779 780 781 782 783 784 | |
with_assistant_persona(name='AI Assistant')
¶Add and set pre-built general assistant persona
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 | |
with_budget_manager(max_cost=10.0)
¶Enable budget management
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
284 285 286 287 288 289 290 291 | |
with_checkpointing(enabled=True, interval_seconds=300, max_checkpoints=10, max_age_hours=24)
¶Configure checkpointing (minimal - agent handles heavy lifting)
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
with_creative_persona(name='Creative Assistant')
¶Add and set pre-built creative persona
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
801 802 803 804 805 806 807 808 809 810 811 812 813 814 | |
with_developer_persona(name='Senior Developer')
¶Add and set pre-built developer persona
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 | |
with_docker(enabled=True)
¶Enable Docker
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
678 679 680 681 682 | |
with_docker_vfs(config=None)
¶Enable Docker VFS
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
666 667 668 669 670 | |
with_executive_persona(name='Executive Assistant')
¶Add and set pre-built executive persona
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
816 817 818 819 820 821 822 823 824 825 826 827 828 829 | |
with_lsp(enabled=True)
¶Enable LSP
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
672 673 674 675 676 | |
with_models(fast_model, complex_model=None)
¶Set LLM models
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
264 265 266 267 268 269 | |
with_name(name)
¶Set agent name
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
259 260 261 262 | |
with_rate_limiter(enable_rate_limiting=True, enable_model_fallback=True, enable_key_rotation=True, key_rotation_mode='balance', max_retries=3)
¶Configure rate limiter settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable_rate_limiting
|
bool
|
Enable rate limiting |
True
|
enable_model_fallback
|
bool
|
Enable automatic model fallback |
True
|
enable_key_rotation
|
bool
|
Enable multi-key rotation |
True
|
key_rotation_mode
|
str
|
"drain" (one key until limit) or "balance" (round-robin) |
'balance'
|
max_retries
|
int
|
Max retry attempts |
3
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
with_rule_config(config_path)
¶Set path to RuleSet configuration file
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
835 836 837 838 | |
with_stream(enable=True)
¶Enable/disable streaming
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
300 301 302 303 | |
with_system_message(message)
¶Set system message. Stored in AgentModelData for all LLM calls.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
271 272 273 274 275 276 277 | |
with_temperature(temp)
¶Set temperature
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
279 280 281 282 | |
with_vfs_window_lines(lines)
¶Set max VFS window lines
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
305 306 307 308 | |
with_world_model(world_model)
¶Set initial world model.
This creates a read-write VFS file 'world_model' that the agent can read and update with world facts during execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world_model
|
dict[str, Any]
|
Dict with initial world facts |
required |
Example
.with_world_model({ "project_name": "MyProject", "environment": "production", "user_preferences": {"language": "de"} })
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
MCPConfig
¶
Bases: BaseModel
MCP server and tools configuration
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
74 75 76 77 78 79 80 81 82 83 | |
RateLimiterConfig
¶
Bases: BaseModel
Rate Limiter configuration
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
example_usage()
async
¶Example usage of the new FlowAgentBuilder
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
chain
¶
CF
¶Chain Format - handles formatting and data extraction between tasks.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
__sub__(key)
¶Implements the - operator for data extraction keys.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
23 24 25 26 27 28 29 30 31 32 33 34 | |
Chain
¶
Bases: ChainBase
The main class for creating and executing sequential chains of tasks.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
a_run(query, **kwargs)
async
¶Executes the chain of tasks asynchronously with dynamic method selection, data extraction, and auto-parallelization.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
ChainBase
¶Abstract base class for all chain types, providing common operators.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
__add__(other)
¶Implements the + operator for parallel execution.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
56 57 58 | |
__and__(other)
¶Implements the & operator, an alias for parallel execution.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
60 61 62 | |
__call__(*args, **kwargs)
¶Allows the chain to be called like a function, returning an awaitable runner.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
92 93 94 | |
__mod__(other)
¶Implements the % operator for defining a false/else branch in a condition.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
68 69 70 71 72 73 74 75 | |
__or__(other)
¶Implements the | operator for defining a fallback/error handling path.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
64 65 66 | |
__rshift__(other)
¶Implements the >> operator to chain tasks sequentially.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
49 50 51 52 53 54 | |
set_progress_callback(progress_tracker)
¶Recursively sets the progress callback for all tasks in the chain.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
ConditionalChain
¶
Bases: ChainBase
Handles conditional execution based on a condition.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
a_run(data, **kwargs)
async
¶Executes the true or false branch based on the condition.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
159 160 161 162 163 164 165 166 167 168 169 170 | |
ErrorHandlingChain
¶
Bases: ChainBase
Handles exceptions in a primary chain by executing a fallback chain.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
a_run(query, **kwargs)
async
¶Tries the primary chain and executes the fallback on failure.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
180 181 182 183 184 185 186 | |
Function
¶
Bases: ChainBase
A wrapper to treat native Python functions as chainable components.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
a_run(data, **kwargs)
async
¶Executes the wrapped function, handling both sync and async cases.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
120 121 122 123 124 125 126 127 | |
IS
¶Conditional check for branching logic.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
36 37 38 39 40 41 | |
ParallelChain
¶
Bases: ChainBase
Handles parallel execution of multiple agents or chains.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
a_run(query, **kwargs)
async
¶Runs all agents/chains in parallel.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
138 139 140 141 142 | |
chain_to_graph(self)
¶Convert chain to hierarchical structure with complete component detection.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
print_graph(self)
¶Enhanced chain visualization with complete functionality coverage and parallel detection.
Source code in toolboxv2/mods/isaa/base/Agent/chain.py
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
checkpoint_manager
¶
CheckpointManager - Complete persistence for FlowAgent
Provides: - Full agent state serialization - Auto-load on initialization - Checkpoint rotation and cleanup
Author: FlowAgent V2
AgentCheckpoint
dataclass
¶Complete agent checkpoint data
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_summary()
¶Get human-readable summary
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
CheckpointManager
¶Manages agent checkpoints for persistence and recovery.
Features: - Auto-load latest checkpoint on init - Full state serialization - Checkpoint rotation (keep N newest)
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
__init__(agent, checkpoint_dir=None, auto_load=True, max_checkpoints=5, max_age_hours=168)
¶Initialize CheckpointManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent
|
Parent FlowAgent instance |
required |
checkpoint_dir
|
str | None
|
Directory for checkpoints (auto-detected if None) |
None
|
auto_load
|
bool
|
Auto-load latest checkpoint on init |
True
|
max_checkpoints
|
int
|
Maximum checkpoints to keep |
5
|
max_age_hours
|
int
|
Max age before auto-cleanup |
168
|
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
auto_restore(function_registry=None)
async
¶Auto-restore from latest checkpoint if available. Should be called after agent initialization.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Restoration statistics or empty dict if no checkpoint |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
cleanup_old(keep_count=None)
async
¶Delete old checkpoints, keeping newest N.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keep_count
|
int | None
|
Number to keep (uses max_checkpoints if None) |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Cleanup statistics |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
create()
async
¶Create checkpoint from current agent state.
Returns:
| Type | Description |
|---|---|
AgentCheckpoint
|
AgentCheckpoint with full state |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
delete_checkpoint(filename)
async
¶Delete a specific checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
512 513 514 515 516 517 518 519 520 521 522 523 | |
get_stats()
¶Get checkpoint manager statistics
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
list_checkpoints(max_age_hours=None)
¶List available checkpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_age_hours
|
int | None
|
Filter by max age (uses default if None) |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of checkpoint info dicts |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
load_latest()
async
¶Load the latest checkpoint.
Returns:
| Type | Description |
|---|---|
AgentCheckpoint | None
|
AgentCheckpoint or None if not found |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
restore(checkpoint=None, restore_sessions=True, restore_tools=True, restore_statistics=True, function_registry=None)
async
¶Restore agent state from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint | None
|
Checkpoint to restore (loads latest if None) |
None
|
restore_sessions
|
bool
|
Restore session data |
True
|
restore_tools
|
bool
|
Restore tool registry |
True
|
restore_statistics
|
bool
|
Restore statistics |
True
|
function_registry
|
dict[str, Callable] | None
|
Dict mapping tool names to functions |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Restoration statistics |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
save(checkpoint=None, filename=None)
async
¶Save checkpoint to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint | None
|
Checkpoint to save (creates new if None) |
None
|
filename
|
str | None
|
Custom filename (auto-generated if None) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Filepath of saved checkpoint |
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
save_current()
async
¶Shortcut to create and save checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/checkpoint_manager.py
270 271 272 | |
config
¶
A2AConfig
¶
Bases: BaseModel
Configuration for A2A integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
116 117 118 119 120 121 122 | |
ADKConfig
¶
Bases: BaseModel
Configuration for ADK integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
AgentConfig
¶
Bases: BaseModel
Main configuration schema for an EnhancedAgent.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
load_from_yaml(path)
classmethod
¶Loads configuration from a YAML file.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
201 202 203 204 205 206 207 208 209 210 | |
save_to_yaml(path)
¶Saves the current configuration to a YAML file.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
212 213 214 215 216 217 218 219 | |
MCPConfig
¶
Bases: BaseModel
Configuration for MCP integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
107 108 109 110 111 112 113 | |
ModelConfig
¶
Bases: BaseModel
Configuration specific to an LLM model via LiteLLM.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
ObservabilityConfig
¶
Bases: BaseModel
Configuration for observability (OpenTelemetry).
Source code in toolboxv2/mods/isaa/base/Agent/config.py
125 126 127 128 129 130 131 132 | |
docker_vfs
¶
DockerVFS - Docker-based execution environment for VFS
Provides isolated container execution with bidirectional sync between VFS and Docker container.
Author: FlowAgent V2
CommandResult
dataclass
¶Result of a command execution
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
DockerConfig
dataclass
¶Docker configuration
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
DockerVFS
¶Docker-based execution environment for VFS.
Features: - Container per session (non-persistent) - Bidirectional file sync with VFS - Command execution in isolated environment - ToolboxV2 pre-installed - Web app port exposure
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
__init__(vfs, config=None, on_output=None)
¶Initialize DockerVFS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vfs
|
'VirtualFileSystemV2'
|
VirtualFileSystemV2 instance to sync with |
required |
config
|
DockerConfig | None
|
Docker configuration |
None
|
on_output
|
Callable[[str], None] | None
|
Callback for streaming output |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
cleanup()
async
¶Clean up resources
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
641 642 643 644 | |
create_container()
async
¶Create and start a new Docker container.
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with container info |
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
destroy_container()
async
¶Stop and remove the container.
Returns:
| Type | Description |
|---|---|
dict
|
Result dict |
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
from_checkpoint(data)
¶Restore from checkpoint (history only, container is not persistent)
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
625 626 627 628 629 630 631 632 633 634 635 | |
get_app_logs(lines=100)
async
¶Get web app logs
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
571 572 573 574 575 576 577 578 579 580 581 | |
get_history(last_n=None)
¶Get command execution history
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
598 599 600 601 | |
get_status()
¶Get container status
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
587 588 589 590 591 592 593 594 595 596 | |
run_command(command, timeout=None, sync_before=True, sync_after=True)
async
¶Run a command in the Docker container.
This is the primary tool exported for agent use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command to execute |
required |
timeout
|
int | None
|
Command timeout in seconds |
None
|
sync_before
|
bool
|
Sync VFS to container before execution |
True
|
sync_after
|
bool
|
Sync container to VFS after execution |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with command output |
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
start_web_app(entrypoint, port=8080, env=None)
async
¶Start a web application in the container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entrypoint
|
str
|
Command to start the app (e.g., "python app.py") |
required |
port
|
int
|
Port the app listens on inside container |
8080
|
env
|
dict[str, str] | None
|
Environment variables |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with access URL |
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
stop_web_app()
async
¶Stop running web app
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
561 562 563 564 565 566 567 568 569 | |
to_checkpoint()
¶Serialize DockerVFS state for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
create_docker_vfs_tool(docker_vfs)
¶Create a tool definition for the agent.
Returns a dict that can be used with add_tool.
Source code in toolboxv2/mods/isaa/base/Agent/docker_vfs.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
execution_engine
¶
ExecutionEngine V3 - Clean Architecture with Strict ChatML Compliance
Key Improvements over V2: 1. STRICT HISTORY COMPLIANCE: Assistant(tool_calls) → Tool(result) cycle guaranteed 2. FLUID PIPELINE: No rigid phases, model chooses tools dynamically 3. DYNAMIC AUTO-FOCUS: Injected as message, not static system prompt 4. SIMPLIFIED LOOP: Single unified execution loop 5. LIGHTWEIGHT MICROAGENTS: Shared VFS with context locks
Author: FlowAgent V3 Version: 3.0.0
AutoFocusTracker
¶Tracks recent file/tool operations for dynamic context injection.
V3 Improvement: Instead of injecting into system prompt (static), this builds a context string that gets injected dynamically before each LLM call as a separate message.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
build_context()
¶Build context string for injection
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
clear()
¶Clear all entries
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
372 373 374 | |
record_tool(tool_name, result)
¶Record tool execution result
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
329 330 331 332 333 334 335 336 337 | |
record_vfs(filename, operation, content='')
¶Record VFS operation
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
320 321 322 323 324 325 326 327 | |
ChatHistoryManager
¶CRITICAL: This class solves the History Discontinuity Bug.
The bug in V2: Tool results were added without the preceding assistant message that contained the tool_calls. This broke the model's understanding of what actions it had taken.
Solution: Strict enforcement of the ChatML cycle: 1. Assistant message with tool_calls array 2. Tool message(s) with matching tool_call_id(s)
The manager validates and maintains this invariant.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
add_assistant_text(content)
¶Add assistant message without tool calls (final answer, thinking, etc.)
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
204 205 206 | |
add_assistant_with_tools(content, tool_calls)
¶SOLVED: WTF Bug Fix - Line ~720 in V2
This method ensures the assistant message with tool_calls is ALWAYS added to history before any tool results. The tool_call_ids are tracked so we can validate tool results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str | None
|
Optional text content from assistant |
required |
tool_calls
|
list[dict]
|
List of tool call objects from LLM response |
required |
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
add_system(content)
¶Add or update system message (always first)
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
135 136 137 138 139 140 | |
add_tool_result(tool_call_id, content, name=None)
¶Add tool result with validation.
Returns False if the tool_call_id doesn't match a pending call, which would indicate a history corruption.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
add_user(content)
¶Add user message
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
142 143 144 145 | |
clear()
¶Clear all messages
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
273 274 275 276 | |
from_checkpoint(data)
classmethod
¶Restore from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
285 286 287 288 289 290 291 | |
get_last_n(n)
¶Get last N messages, always including system
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
get_messages()
¶Get all messages for LLM call
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
208 209 210 | |
inject_context(context, position='before_last_user')
¶Inject dynamic context (like Auto-Focus) into history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
str
|
The context string to inject |
required |
position
|
str
|
Where to inject - 'before_last_user' or 'end' |
'before_last_user'
|
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
to_checkpoint()
¶Serialize for persistence
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
278 279 280 281 282 283 | |
ExecutionConfig
¶
Bases: BaseModel
Configuration for execution
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
101 102 103 104 105 106 107 108 | |
ExecutionEngine
¶ExecutionEngine V3 - Clean Architecture
Key improvements: 1. Strict ChatML history via ChatHistoryManager 2. Dynamic Tool Discovery - max 5 active tools 3. Dynamic Auto-Focus injection 4. Simplified single loop
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 | |
clear_focus(session_id)
¶Clear auto-focus for session
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1647 1648 1649 1650 | |
execute(query, session_id='default', config=None, **kwargs)
async
¶Main execution entry point.
This is the unified execution loop that replaces the complex phase-based state machine in V2.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | |
execute_stream(query, session_id='default', config=None, **kwargs)
async
¶Streaming execution - yields intermediate results.
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | |
get_focus_context(session_id)
¶Get current auto-focus context
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1643 1644 1645 | |
get_state(execution_id)
¶Get execution state
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1639 1640 1641 | |
ExecutionResult
dataclass
¶Result of execution
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
481 482 483 484 485 486 487 488 489 490 491 492 493 | |
ExecutionState
dataclass
¶Execution state - simplified from V2
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
ExecutionStatus
¶
Bases: str, Enum
Simplified execution status
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
39 40 41 42 43 44 | |
FocusEntry
dataclass
¶Single focus entry
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
298 299 300 301 302 303 304 305 | |
HistoryMessage
¶
Bases: BaseModel
Validated message for chat history
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
to_dict()
¶Convert to LiteLLM-compatible dict
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
87 88 89 90 91 92 93 94 95 96 97 98 | |
LoopDetector
¶Intelligent loop detection with semantic matching.
Detects: 1. Same tool called 3+ times with similar args 2. Same action pattern repeated 3. Semantic goal repetition
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
detect()
¶Check for loops. Returns (is_loop, reason)
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
record(tool_name, args=None)
¶Record a tool call
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
412 413 414 415 416 417 418 419 420 421 422 | |
reset()
¶Reset detector
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
441 442 443 444 | |
TerminationReason
¶
Bases: str, Enum
Why did execution stop?
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
47 48 49 50 51 52 53 54 55 | |
ToolCallRecord
¶
Bases: BaseModel
Record of a tool call for history tracking
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
ToolDiscoveryManager
¶Manages dynamic tool loading with a max active tool limit.
Workflow: 1. Agent calls discover_tools("send discord message") 2. Manager returns matching tools with descriptions 3. Agent calls load_tools(load=["discord_send_message"]) 4. Tool is now available in next LLM call 5. When done, agent calls load_tools(unload=["discord_send_message"])
Constraints: - Max 5 active tools at once (configurable) - System tools (VFS, Control, Discovery) are always available - Loading a 6th tool requires unloading one first
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | |
discover(query, category=None)
¶Search tools by query and/or category.
Returns list of tool info dicts (not full LiteLLM format): [{"name": "...", "description": "...", "category": "...", "loaded": bool}, ...]
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | |
get_active_tool_names()
¶Get names of currently active tools
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
831 832 833 | |
get_active_tools_litellm()
¶Get currently active tools in LiteLLM format
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
827 828 829 | |
get_status()
¶Get human-readable status
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
835 836 837 838 839 840 841 | |
is_tool_active(name)
¶Check if a tool is currently active
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
847 848 849 | |
load(tool_names)
¶Load tools into active set.
Returns: {"loaded": [...], "failed": [...], "message": "..."}
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
reset()
¶Reset active tools
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
843 844 845 | |
unload(tool_names)
¶Unload tools from active set.
Returns: {"unloaded": [...], "message": "..."}
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | |
create_engine_v3(agent, human_online=False, callback=None, max_active_tools=5)
¶Factory function for ExecutionEngine
Source code in toolboxv2/mods/isaa/base/Agent/execution_engine.py
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | |
executors
¶
DockerCodeExecutor
¶
Bases: _BaseExecutorClass
Executes Python code in a sandboxed Docker container.
Requires Docker to be installed and running, and the 'docker' Python SDK.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
execute(code)
¶Directly execute code, returning detailed dictionary.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
333 334 335 336 | |
RestrictedPythonExecutor
¶
Bases: _BaseExecutorClass
Executes Python code using restrictedpython.
Safer than exec() but NOT a full sandbox. Known vulnerabilities exist. Use with extreme caution and only with trusted code sources or for low-risk operations. Docker is strongly recommended for untrusted code.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
execute(code)
¶Directly execute code, returning detailed dictionary.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
193 194 195 196 | |
get_code_executor(config)
¶Creates a code executor instance based on configuration.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
flow_agent
¶
FlowAgent V2 - Production-ready Agent System
Refactored architecture: - SessionManager: Session lifecycle with ChatSession integration - ToolManager: Unified tool registry (local, MCP, A2A) - CheckpointManager: Full state persistence - BindManager: Agent-to-agent binding - ExecutionEngine: MAKER/RLM inspired orchestration with Pause/Continue
Author: FlowAgent V2
FlowAgent
¶Production-ready autonomous agent with session isolation.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 | |
__mod__(other)
¶Implements % operator for conditional branching
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1983 1984 1985 | |
a_audio(audio, session_id='default', language='en', **kwargs)
async
¶Process a complete audio file/buffer through the agent.
This function handles the full pipeline: 1. Audio input (file, bytes, or path) 2. Understanding (STT or native audio model) 3. Processing (your agent logic via processor callback) 4. Response generation (TTS or native audio model)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio
|
Union[bytes, Path, str]
|
Audio input (bytes, file path, or Path object) |
required |
session_id
|
str
|
Session identifier |
'default'
|
language
|
str
|
Response language ("en", "de") |
'en'
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[bytes | None, str, list, dict]
|
Audio bytes for playback |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | |
a_run(query, session_id='default', execution_id=None, use_native_tools=True, human_online=False, intermediate_callback=None, human_response=None, max_iterations=15, token_budget=10000, **kwargs)
async
¶Main entry point for agent execution.
Architecture: MAKER (parallel decomposition) + RLM (VFS-based context)
Features: - Auto Intent Detection → Immediate/Tools/Decomposition - Category-based tool selection (max 5 tools) - RLM-VFS style ReAct loop - Parallel microagent execution for complex tasks - Pause/Continue support - Human-in-the-loop - Transaction-based rollback - Non-blocking learning
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
User query |
required |
session_id
|
str
|
Session identifier |
'default'
|
execution_id
|
str | None
|
For continuing paused execution |
None
|
use_native_tools
|
bool
|
LiteLLM native tool calling vs a_format_class |
True
|
human_online
|
bool
|
Allow human-in-the-loop |
False
|
intermediate_callback
|
Callable[[str], None] | None
|
User-facing status messages |
None
|
human_response
|
str | None
|
Response from human (for continuation) |
None
|
max_iterations
|
int
|
Max ReAct iterations (default 15) |
15
|
token_budget
|
int
|
Token budget per iteration (default 10000) |
10000
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Response string or special response for paused states: |
str
|
|
str
|
|
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
a_stream(query, session_id='default', execution_id=None, use_native_tools=True, human_online=False, intermediate_callback=None, human_response=None, max_iterations=15, token_budget=10000, **kwargs)
async
¶Main entry point for streaming agent execution.
Architecture: MAKER (parallel decomposition) + RLM (VFS-based context)
Features: - Auto Intent Detection → Immediate/Tools/Decomposition - Category-based tool selection (max 5 tools) - RLM-VFS style ReAct loop - Parallel microagent execution for complex tasks - Pause/Continue support - Human-in-the-loop - Transaction-based rollback - Non-blocking learning
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
User query |
required |
session_id
|
str
|
Session identifier |
'default'
|
execution_id
|
str | None
|
For continuing paused execution |
None
|
use_native_tools
|
bool
|
LiteLLM native tool calling vs a_format_class |
True
|
human_online
|
bool
|
Allow human-in-the-loop |
False
|
intermediate_callback
|
Callable[[str], None] | None
|
User-facing status messages |
None
|
human_response
|
str | None
|
Response from human (for continuation) |
None
|
max_iterations
|
int
|
Max ReAct iterations (default 15) |
15
|
token_budget
|
int
|
Token budget per iteration (default 10000) |
10000
|
**kwargs
|
Additional options |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Response string or special response for paused states: |
str
|
|
str
|
|
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
a_stream_audio(audio_chunks, session_id='default', language='en', **kwargs)
async
¶Process a stream of audio chunks through the agent.
Use this for real-time audio processing where you want to yield audio output as soon as possible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_chunks
|
Generator[bytes, None, None]
|
Generator yielding audio byte chunks |
required |
session_id
|
str
|
Session identifier |
'default'
|
language
|
str
|
Response language ("en", "de") |
'en'
|
**kwargs
|
Additional options |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncGenerator[bytes, None]
|
Audio bytes chunks for immediate playback |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | |
add_tool(tool_func, name=None, description=None, category=None, flags=None)
async
¶Register a tool.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | |
bind(partner, mode='public', session_id='default')
async
¶Bind to another agent.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1895 1896 1897 | |
cancel_execution(execution_id)
async
¶Cancel an execution and rollback changes.
Returns:
| Type | Description |
|---|---|
bool
|
True if cancelled |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
602 603 604 605 606 607 608 609 610 611 612 | |
close()
async
¶Clean shutdown.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | |
context_overview(session_id=None, print_visual=True)
async
¶Analysiert den aktuellen Token-Verbrauch des Kontexts und gibt eine Übersicht zurück.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str | None
|
Die zu analysierende Session (oder None für generische Analyse) |
None
|
print_visual
|
bool
|
Ob eine grafische CLI-Anzeige ausgegeben werden soll |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Ein Dictionary mit den detaillierten Token-Metriken. |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | |
continue_execution(execution_id, human_response=None, **kwargs)
async
¶Continue a paused execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
execution_id
|
str
|
ID of paused execution |
required |
human_response
|
str | None
|
Response from human (if was waiting) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Response string |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
get_tool(name)
¶Get tool function by name.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
831 832 833 | |
init_session_tools(session)
¶Initialize session-specific tools for VFS V2, Docker, and filesystem operations.
Tools are categorized: - vfs: Virtual File System operations - docker: Container execution (flag: requires_docker) - filesystem: Real filesystem copy operations (flag: filesystem_access) - memory: RAG and history - situation: Behavior control
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |
list_executions()
¶List all active/paused executions.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
614 615 616 617 618 619 | |
pause_execution(execution_id)
async
¶Pause a running execution.
Returns:
| Type | Description |
|---|---|
dict | None
|
Execution state dict or None if not found |
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
589 590 591 592 593 594 595 596 597 598 599 600 | |
restore(function_registry=None)
async
¶Restore from checkpoint.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1887 1888 1889 | |
save()
async
¶Save checkpoint.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1883 1884 1885 | |
unbind(partner_name)
¶Unbind from partner.
Source code in toolboxv2/mods/isaa/base/Agent/flow_agent.py
1899 1900 1901 | |
lsp_manager
¶
LSP Manager - Language Server Protocol integration for VFS
Handles automatic download, installation, and management of LSP servers for code diagnostics, hints, and error detection.
Author: FlowAgent V2
Diagnostic
dataclass
¶A diagnostic, such as an error or warning
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
to_dict()
¶Convert to dictionary for serialization
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
to_display_string(content_lines=None)
¶Format diagnostic for display
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
LSPManager
¶Manages LSP servers for code diagnostics.
Features: - Automatic server installation - Server lifecycle management - Diagnostic retrieval - Caching for performance
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | |
__init__(cache_dir=None, auto_install=True, timeout=30.0)
¶Initialize LSP Manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_dir
|
str | None
|
Directory for caching LSP data |
None
|
auto_install
|
bool
|
Automatically install missing LSP servers |
True
|
timeout
|
float
|
Timeout for LSP operations in seconds |
30.0
|
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
clear_cache()
¶Clear diagnostic cache
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
615 616 617 | |
ensure_server_for_language(language_id)
async
¶Ensure LSP server is available for a language
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
636 637 638 639 640 641 | |
get_available_servers()
¶Get list of available (installed) LSP servers
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
632 633 634 | |
get_diagnostics(file_path, content, language_id)
async
¶Get diagnostics for a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Virtual file path |
required |
content
|
str
|
File content |
required |
language_id
|
str
|
Language identifier (e.g., "python", "javascript") |
required |
Returns:
| Type | Description |
|---|---|
list[Diagnostic]
|
List of Diagnostic objects |
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
get_server_status()
¶Get status of all LSP servers
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
619 620 621 622 623 624 625 626 627 628 629 630 | |
stop_all_servers()
async
¶Stop all running LSP servers
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
610 611 612 613 | |
stop_server(server_name)
async
¶Stop a running LSP server
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
598 599 600 601 602 603 604 605 606 607 608 | |
LSPServerConfig
dataclass
¶Configuration for an LSP server
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
107 108 109 110 111 112 113 114 115 116 117 | |
Position
dataclass
¶Position in a text document (0-indexed)
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
38 39 40 41 42 | |
Range
dataclass
¶A range in a text document
Source code in toolboxv2/mods/isaa/base/Agent/lsp_manager.py
45 46 47 48 49 | |
mda_accomplish
¶
MAKER Framework Implementation for FlowAgent¶
Implements "Massively Decomposed Agentic Processes" (MDAPs) based on the paper: "Solving a Million-Step LLM Task with Zero Errors" (Meyerson et al., 2025)
Key Components: 1. DivideNode - Recursive task decomposition with complexity estimation 2. TaskTreeBuilderNode - Builds execution tree with parallel groups 3. AtomicConquerNode - Executes atomic tasks with k-voting and red-flagging 4. ResultAggregatorNode - Aggregates partial results 5. MDAFlow - Orchestrates the complete MDAP process
Features: - First-to-ahead-by-k voting for error correction - Red-flagging to discard unreliable responses - Stop/Resume with compact checkpoint serialization - Integration with FlowAgent's existing checkpoint system
Author: Integration with ToolBoxV2 FlowAgent
ActionType
¶
Bases: str, Enum
Type of action for an atomic task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
78 79 80 81 82 83 | |
AggregatedResult
¶
Bases: BaseModel
Final aggregated result
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
141 142 143 144 145 146 147 148 149 150 | |
AtomicAction
¶
Bases: BaseModel
Single atomic action within a task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
102 103 104 105 106 107 108 | |
AtomicConquerNode
¶
Bases: AsyncNode
Executes atomic tasks with optional k-voting
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 | |
AtomicResult
¶
Bases: BaseModel
Result of an atomic execution
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
120 121 122 123 124 125 126 127 128 129 130 131 | |
ContextFetchSpec
¶
Bases: BaseModel
Specification for context fetching
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
94 95 96 97 98 99 | |
DivideNode
¶
Bases: AsyncNode
Recursively divides tasks until minimum complexity is reached. Implements MAD (Maximal Agentic Decomposition) from MAKER paper.
NEW: Detects when subtasks require external tools or context.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | |
exec_async(prep_res)
async
¶Execute task division
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
post_async(shared, prep_res, exec_res)
async
¶Update state after division
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | |
prep_async(shared)
async
¶Prepare for division
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
DivisionResult
¶
Bases: BaseModel
Result of task division
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
69 70 71 72 73 74 75 | |
FlowAgentMDAMixin
¶Mixin class that adds a_accomplish capability to FlowAgent.
This mixin integrates the MAKER framework for massively decomposed agentic processes with full stop/resume support.
Usage
class EnhancedFlowAgent(FlowAgentMDAMixin, FlowAgent): pass
agent = EnhancedFlowAgent(amd) result = await agent.a_accomplish("Complex task...")
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 | |
a_accomplish(task, context='', min_complexity=2, max_parallel=5, k_margin=2, num_attempts=3, model_strength='medium', max_division_depth=10, session_id=None, progress_callback=None, auto_checkpoint=True, checkpoint_interval=60, **kwargs)
async
¶Execute a complex task using Massively Decomposed Agentic Processes (MDAP).
Implements the MAKER framework from: "Solving a Million-Step LLM Task with Zero Errors" (Meyerson et al., 2025)
Key Features: - Recursive task decomposition based on complexity - First-to-ahead-by-k voting for error correction - Red-flagging to discard unreliable responses - Full stop/resume with compact checkpoints - Integration with FlowAgent checkpoint system
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
Main task to accomplish |
required |
context
|
str
|
Additional context for the task |
''
|
min_complexity
|
int
|
Minimum complexity threshold (0-10) before stopping decomposition |
2
|
max_parallel
|
int
|
Maximum number of parallel task executions |
5
|
k_margin
|
int
|
Required vote margin for k-voting (higher = more reliable, slower) |
2
|
num_attempts
|
int
|
Number of attempts per atomic task for voting |
3
|
model_strength
|
Literal['weak', 'medium', 'strong']
|
Model capability assumption ("weak", "medium", "strong") - weak: Max 2 subtasks per division - medium: Max 3 subtasks per division - strong: Max 5 subtasks per division |
'medium'
|
max_division_depth
|
int
|
Maximum recursion depth for decomposition |
10
|
session_id
|
str
|
Session identifier for tracking |
None
|
progress_callback
|
Callable
|
Optional callback for progress updates |
None
|
auto_checkpoint
|
bool
|
Whether to auto-save checkpoints |
True
|
checkpoint_interval
|
int
|
Seconds between auto-checkpoints |
60
|
**kwargs
|
Additional arguments |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict containing: - success: bool - Whether the task completed successfully - result: str - Final aggregated result - partial_results: dict - Individual task results - checkpoint: dict - Checkpoint data for resume - stats: dict - Execution statistics - total_divisions: Number of task divisions - voting_rounds: Total voting rounds used - red_flags_caught: Number of red-flagged responses - total_tasks: Total atomic tasks - successful_tasks: Successfully completed tasks - failed_tasks: Failed tasks - cost_info: dict - Cost and token information - total_cost: Accumulated cost - tokens_in: Input tokens used - tokens_out: Output tokens used - execution_time_s: Total execution time |
Example
Simple usage¶
result = await agent.a_accomplish( task="Analyze the uploaded codebase and create comprehensive documentation", context="Python FastAPI project with SQLAlchemy ORM", min_complexity=3 )
if result["success"]: print(result["result"]) else: print(f"Failed: {result.get('error')}") # Can resume later with checkpoint saved_checkpoint = result["checkpoint"]
Resume from checkpoint¶
result = await agent.a_accomplish( task="...", # Same task resume_checkpoint=MDACheckpoint.from_dict(saved_checkpoint) )
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 | |
clear_mda_checkpoint(checkpoint_id=None)
¶Clear MDA checkpoint(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_id
|
str
|
Specific checkpoint to clear, or None for all |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 | |
get_mda_stats()
¶Get aggregated MDA statistics across all sessions.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict with aggregated statistics |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 | |
list_mda_checkpoints()
¶List available MDA checkpoints.
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of checkpoint summaries |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 | |
pause_accomplish()
async
¶Pause the current MDA process and get checkpoint.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict with: - success: bool - checkpoint: MDACheckpoint data for resume - message: Status message - resumable_tasks: List of tasks that can be resumed |
Example
During execution, pause the process¶
pause_result = await agent.pause_accomplish()
if pause_result["success"]: # Save checkpoint for later checkpoint_data = pause_result["checkpoint"] with open("mda_checkpoint.json", "w") as f: json.dump(checkpoint_data, f)
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 | |
resume_accomplish(checkpoint_id=None)
async
¶Resume an MDA process from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_id
|
str
|
Specific checkpoint ID, or None for latest |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Result dict from a_accomplish |
Example
Resume from latest checkpoint¶
result = await agent.resume_accomplish()
Resume from specific checkpoint¶
result = await agent.resume_accomplish(checkpoint_id="mda_abc123...")
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 | |
MDACheckpoint
dataclass
¶Compact checkpoint for MDA process - integrates with AgentCheckpoint
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
from_dict(data)
classmethod
¶Deserialize from dictionary
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
301 302 303 304 | |
get_resumable_tasks()
¶Get tasks that can be resumed
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
to_dict()
¶Serialize to compact dictionary
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
MDAFlow
¶
Bases: AsyncFlow
Massively Decomposed Agentic Process Flow. Implements the complete MAKER framework with stop/resume support.
NEW: Supports external tool calls and context fetching.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | |
run_async(shared)
async
¶Execute the MDA flow
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1859 1860 1861 | |
MDAState
¶Manages the complete state of an MDA process. Supports checkpointing for stop/resume.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | |
add_task_node(node)
¶Add a task node
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1705 1706 1707 1708 | |
create_root_task()
¶Create the root task node
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 | |
from_checkpoint(checkpoint)
classmethod
¶Restore state from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | |
get_atomic_tasks()
¶Get all atomic tasks
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1730 1731 1732 1733 1734 1735 | |
get_task_node(task_id)
¶Get task node by ID
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1710 1711 1712 | |
has_pending_divisions()
¶Check if there are pending divisions
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1726 1727 1728 | |
mark_task_ready(task_id)
¶Mark task as ready for execution
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1719 1720 1721 1722 1723 1724 | |
to_checkpoint()
¶Create checkpoint from current state
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 | |
update_task_node(node)
¶Update a task node
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1714 1715 1716 1717 | |
MDATaskNode
dataclass
¶Compact task node for checkpoint serialization
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
from_dict(data)
classmethod
¶Create from dictionary
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
222 223 224 225 226 227 228 229 230 231 232 233 | |
to_dict()
¶Convert to dictionary for serialization
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
MDATaskStatus
¶
Bases: str, Enum
Status of an MDA task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
157 158 159 160 161 162 163 164 165 166 | |
ResultAggregatorNode
¶
Bases: AsyncNode
Aggregates partial results into final result
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 | |
SubTask
¶
Bases: BaseModel
Single subtask after decomposition
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
54 55 56 57 58 59 60 61 62 63 64 65 66 | |
TaskActionPlan
¶
Bases: BaseModel
Plan of actions for an atomic task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
111 112 113 114 115 116 117 | |
TaskComplexity
¶
Bases: BaseModel
Complexity assessment of a task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
46 47 48 49 50 51 | |
TaskTreeBuilderNode
¶
Bases: AsyncNode
Builds execution tree with parallel groups from atomic tasks. Identifies independent tasks for parallel execution.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | |
ToolCallSpec
¶
Bases: BaseModel
Specification for a tool call
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
86 87 88 89 90 91 | |
VotingCandidate
¶
Bases: BaseModel
Candidate for voting
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
134 135 136 137 138 | |
a_accomplish(agent, task, context='', min_complexity=2, max_parallel=5, k_margin=2, num_attempts=3, model_strength='medium', max_division_depth=10, session_id=None, progress_callback=None, resume_checkpoint=None, enable_tools=True, enable_context_fetch=True, allowed_tools=None, **kwargs)
async
¶Massively Decomposed Agentic Process (MDAP) for complex tasks.
Implements the MAKER framework from: "Solving a Million-Step LLM Task with Zero Errors" (Meyerson et al., 2025)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance |
required | |
task
|
str
|
Main task to accomplish |
required |
context
|
str
|
Additional context |
''
|
min_complexity
|
int
|
Minimum complexity before stopping decomposition (0-10) |
2
|
max_parallel
|
int
|
Maximum parallel executions |
5
|
k_margin
|
int
|
Required vote margin for k-voting |
2
|
num_attempts
|
int
|
Attempts per atomic task |
3
|
model_strength
|
Literal['weak', 'medium', 'strong']
|
Model strength ("weak", "medium", "strong") |
'medium'
|
max_division_depth
|
int
|
Maximum decomposition depth |
10
|
session_id
|
str
|
Session ID |
None
|
progress_callback
|
Callable
|
Callback for progress updates |
None
|
resume_checkpoint
|
MDACheckpoint
|
Checkpoint to resume from |
None
|
enable_tools
|
bool
|
Whether to allow tool calls in atomic tasks |
True
|
enable_context_fetch
|
bool
|
Whether to allow context fetching |
True
|
allowed_tools
|
list[str]
|
List of allowed tool names (None = all) |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict with: - success: bool - result: Final aggregated result - checkpoint: MDACheckpoint for resume - stats: Execution statistics (including tool_calls, context_fetches) - cost_info: Cost information |
Example
With tool access¶
result = await agent.a_accomplish( task="Read config.json and update the database settings", context="Project root is /home/user/project", enable_tools=True, allowed_tools=["file_read", "file_write", "db_query"] )
Pure reasoning (no tools)¶
result = await agent.a_accomplish( task="Analyze this algorithm's complexity", context="def sort(arr): ...", enable_tools=False )
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 | |
bind_accomplish_to_agent(agent, and_as_tool=True)
async
¶Bind a_accomplish method to an existing FlowAgent instance.
This function adds the MDA capabilities to an agent without requiring inheritance or class modification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance |
required |
Example
from flowagent_mda import bind_accomplish_to_agent
agent = FlowAgent(amd) bind_accomplish_to_agent(agent)
Now can use a_accomplish¶
result = await agent.a_accomplish("Complex task...")
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 | |
extract_mda_checkpoint(agent_checkpoint, checkpoint_id=None)
¶Extract MDA checkpoint from agent checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_checkpoint
|
dict
|
Agent's checkpoint dictionary |
required |
checkpoint_id
|
str
|
Specific checkpoint ID, or None for latest |
None
|
Returns:
| Type | Description |
|---|---|
Optional[MDACheckpoint]
|
MDACheckpoint or None |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
integrate_mda_checkpoint(agent_checkpoint, mda_checkpoint)
¶Integrate MDA checkpoint into agent checkpoint for unified storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_checkpoint
|
dict
|
Agent's checkpoint dictionary |
required |
mda_checkpoint
|
dict
|
MDA checkpoint dictionary |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Updated agent checkpoint with MDA data |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 | |
pause_accomplish(agent, session_id=None)
async
¶Pause an ongoing MDA process and return checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance |
required | |
session_id
|
str
|
Session ID of the MDA process |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict with checkpoint data for resume |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 | |
quick_accomplish(agent, task, **kwargs)
async
¶Quick wrapper that returns just the result string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance |
required | |
task
|
str
|
Task to accomplish |
required |
**kwargs
|
Additional arguments for a_accomplish |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Result string or error message |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 | |
with_progress_tracking(cls)
¶Ein Klassendekorator, der die Methoden run_async, prep_async, exec_async, und exec_fallback_async automatisch mit umfassendem Progress-Tracking umwickelt.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
mda_accomplish_v2
¶
MAKER V2 Framework - Massively Decomposed Agentic Processes with Virtual Workspace¶
A complete rewrite of the MAKER framework with:
- Virtual Workspace (Sandboxing): Agents work in isolated environments
- File operations are staged before commit
- Voting on actual diffs, not text outputs
-
Only committed after consensus
-
Safe Tool Registry: Clear separation of tools
- Information-gathering tools (safe for voting)
- Side-effect tools (blocked during voting)
-
Virtual overrides for file operations
-
Incremental Aggregation: Real-time result processing
- After each parallel batch, aggregate and check
- Dynamic abort on impossible tasks
-
Progressive response building
-
Dynamic Recursion: Self-correcting decomposition
- Tasks can signal NEEDS_DECOMPOSITION
- Re-planning triggered automatically
-
Fail-fast on impossible branches
-
Response Type Manager: Flexible output formats
- TEXT: Simple text response
- REPORT: Structured detailed report
- STATUS: Compact status update
- FINAL: Complete synthesized result
Based on: "Solving a Million-Step LLM Task with Zero Errors" (Meyerson et al., 2025)
Author: ToolBoxV2 FlowAgent Integration Version: 2.0.0
ActionType
¶
Bases: str, Enum
Type of action for an atomic task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
113 114 115 116 117 118 119 | |
AggregatedResult
¶
Bases: BaseModel
Final aggregated result
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
230 231 232 233 234 235 236 237 238 239 240 241 242 | |
AggregationAction
¶
Bases: str, Enum
Action to take after aggregation
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
104 105 106 107 108 109 110 | |
AtomicConquerNodeV2
¶
Bases: AsyncNode
Enhanced atomic execution with Virtual Workspace sandboxing.
Key Features: - Safe toolset with virtualized writes - Diff-based voting - Commit only after consensus - Incremental aggregation hooks
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 | |
AtomicResult
¶
Bases: BaseModel
Result of an atomic execution with staging support
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
DivideNodeV2
¶
Bases: AsyncNode
Enhanced division node with response type detection
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | |
DivisionResult
¶
Bases: BaseModel
Result of task division
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
153 154 155 156 157 158 159 | |
FlowAgentMDAMixinV2
¶Mixin that adds MAKER V2 capabilities to FlowAgent.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | |
a_accomplish_v2(task, context='', min_complexity=2, max_parallel=5, k_margin=2, num_attempts=3, model_strength='medium', max_division_depth=10, session_id=None, progress_callback=None, response_type=ResponseType.TEXT, **kwargs)
async
¶Execute complex task using MAKER V2 with Virtual Workspace.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | |
IncrementalAggregator
¶Processes results after each parallel batch execution.
Features: - Progressive response building - Dynamic abort on impossible tasks - Re-planning triggers - Response type detection
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | |
generate_final_response(mda_state, response_type=None)
async
¶Generate the final aggregated response
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | |
process_batch(batch_results, mda_state)
async
¶Process results from a parallel batch execution. Returns status with action to take next.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | |
IncrementalStatus
¶
Bases: BaseModel
Status update after each batch
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
217 218 219 220 221 222 223 224 225 226 227 | |
MDAFlowV2
¶
Bases: AsyncFlow
MAKER V2 Flow with Virtual Workspace and Incremental Aggregation.
Features: - Sandboxed execution with diff-based voting - Dynamic recursion and re-planning - Flexible response types - Full stop/resume support
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 | |
MDAStateV2
¶Enhanced state management with virtual workspace support
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | |
create_root_task()
¶Create the root task node
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | |
from_checkpoint(checkpoint, variable_manager=None)
classmethod
¶Restore state from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | |
inject_tasks(new_subtasks, parent_id=None)
¶Inject new tasks for dynamic recursion
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | |
record_commit(task_id, files)
¶Record a successful commit
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | |
to_checkpoint()
¶Create checkpoint from current state
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 | |
MDATaskNodeV2
dataclass
¶Enhanced task node with staging support
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | |
MDATaskStatus
¶
Bases: str, Enum
Status of an MDA task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
90 91 92 93 94 95 96 97 98 99 100 101 | |
ResponseType
¶
Bases: str, Enum
Type of response to generate
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
70 71 72 73 74 75 76 | |
ResultAggregatorNodeV2
¶
Bases: AsyncNode
Enhanced result aggregation with flexible response types
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 | |
SafeToolRegistry
¶Manages tool classification and virtualization for safe voting.
Categories: - SAFE_: Can be used freely during voting (idempotent, no side effects) - UNSAFE_: Blocked during voting or virtualized - VIRTUAL: Overridden to use VirtualWorkspace
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
classify(tool_name)
¶Get the category of a tool
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
create_virtual_tool_executor(agent, workspace, allowed_unsafe=None)
¶Create a VirtualToolExecutor that wraps agent's arun_function with virtualization for write operations.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
get_safe_tool_names(agent)
¶Get list of tool names that are safe for voting
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
596 597 598 599 600 601 602 603 604 605 606 | |
is_safe_for_voting(tool_name)
¶Check if tool can be used during voting
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
586 587 588 589 590 591 592 593 594 | |
StagedChange
¶
Bases: BaseModel
A staged file change in the virtual workspace
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
171 172 173 174 175 176 177 178 | |
SubTask
¶
Bases: BaseModel
Single subtask after decomposition
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
TaskComplexity
¶
Bases: BaseModel
Complexity assessment of a task
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
127 128 129 130 131 132 133 134 | |
TaskTreeBuilderNodeV2
¶
Bases: AsyncNode
Builds execution tree with parallel groups
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 | |
ToolCallSpec
¶
Bases: BaseModel
Specification for a tool call
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
162 163 164 165 166 167 168 | |
ToolCategory
¶
Bases: str, Enum
Category of tool for safety classification
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
79 80 81 82 83 84 85 86 87 | |
VirtualToolExecutor
¶Executes tools with virtualization layer.
- Safe tools: Executed normally via agent.arun_function
- Write tools: Intercepted and redirected to VirtualWorkspace
- Unsafe tools: Blocked
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | |
execute(tool_name, arguments)
async
¶Execute a tool with virtualization.
Returns:
| Type | Description |
|---|---|
dict
|
dict with keys: success, result, error, virtualized |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
get_execution_summary()
¶Get summary of all executions
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
761 762 763 764 765 766 767 768 769 770 | |
VirtualWorkspace
¶Manages a virtual file system layer for safe, reversible operations.
Key Features: - All writes go to staging area first - Reads check staging, then cache, then real FS - Diff-based voting for consensus - Atomic commit only after voting success
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
commit_to_real_fs(real_write_tool, real_delete_tool=None)
async
¶Apply staged changes to real file system. Called only after voting consensus is reached.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
get_diff_summary()
¶Returns a human-readable summary of staged changes for voting
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
get_staged_files()
¶Get list of files with staged changes
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
427 428 429 | |
get_staging_hash()
¶Generate hash of all staged changes for voting comparison
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
has_changes()
¶Check if there are any staged changes
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
431 432 433 | |
read_file(path, real_fs_tool)
async
¶Read from staging if modified, else from cache, else from real FS. Implements the layered read strategy for consistency.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
rollback()
¶Discard all staged changes without committing
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
423 424 425 | |
virtual_delete_file(path)
¶Stage a file deletion
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
320 321 322 323 324 325 326 327 328 329 330 331 332 | |
virtual_write_file(path, content)
¶Write to staging area only - no real FS modification. Returns confirmation message for agent feedback.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
VotingCandidate
¶
Bases: BaseModel
Candidate for voting with staging
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
208 209 210 211 212 213 214 | |
a_accomplish_v2(agent, task, context='', min_complexity=2, max_parallel=5, k_margin=2, num_attempts=3, model_strength='medium', max_division_depth=10, session_id=None, progress_callback=None, resume_checkpoint=None, enable_tools=True, response_type=ResponseType.TEXT, **kwargs)
async
¶MAKER V2: Massively Decomposed Agentic Process with Virtual Workspace.
Key Improvements over V1: - Virtual Workspace: All file operations sandboxed, committed only after voting - Diff-based Voting: Vote on actual changes, not just text - Incremental Aggregation: Process results after each batch - Dynamic Recursion: Tasks can request further decomposition - Flexible Response Types: TEXT, REPORT, STATUS, FINAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance |
required | |
task
|
str
|
Main task to accomplish |
required |
context
|
str
|
Additional context |
''
|
min_complexity
|
int
|
Minimum complexity threshold (0-10) |
2
|
max_parallel
|
int
|
Maximum parallel executions |
5
|
k_margin
|
int
|
Required vote margin for k-voting |
2
|
num_attempts
|
int
|
Attempts per atomic task |
3
|
model_strength
|
Literal['weak', 'medium', 'strong']
|
Model strength ("weak", "medium", "strong") |
'medium'
|
max_division_depth
|
int
|
Maximum decomposition depth |
10
|
session_id
|
str
|
Session ID |
None
|
progress_callback
|
Callable
|
Callback for progress updates |
None
|
resume_checkpoint
|
dict
|
Checkpoint to resume from |
None
|
enable_tools
|
bool
|
Whether to allow tool calls |
True
|
response_type
|
ResponseType
|
Type of final response |
TEXT
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict with: - success: bool - result: Final result string - response_type: Type of response - checkpoint: Checkpoint data for resume - stats: Execution statistics - cost_info: Cost information - files_modified: List of modified files |
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | |
bind_accomplish_v2_to_agent(agent, and_as_tool=True)
async
¶Bind MAKER V2 capabilities to an existing FlowAgent instance.
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 | |
with_progress_tracking(cls)
¶Decorator for automatic progress tracking on async nodes
Source code in toolboxv2/mods/isaa/base/Agent/mda_accomplish_v2.py
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | |
rule_set
¶
RuleSet - Dynamic Skill/Behavior System for FlowAgent
Provides: - Tool grouping with categories (instead of showing 50 tools, show "Discord Tools available") - Situation-aware instructions based on intent + context - Runtime learning of patterns and behaviors - Live VFS integration (always visible after system_context)
Author: FlowAgent V2
LearnedPattern
dataclass
¶Patterns learned during runtime that provide helpful context.
Example
pattern: "Discord embeds require: title, description, color (hex format)" source_situation: "discord api work" confidence: 0.85
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
is_relevant_to(situation)
¶Check if pattern is relevant to situation
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
148 149 150 151 152 153 154 155 156 157 158 | |
use()
¶Mark pattern as used
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
160 161 162 163 164 165 | |
RuleResult
dataclass
¶Result of rule evaluation for an action
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
168 169 170 171 172 173 174 175 176 177 | |
RuleSet
¶Dynamic skill/behavior system that provides: - Tool grouping for cleaner agent context - Situation-aware instructions - Runtime learning capabilities - Live VFS integration
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
__init__(config_path=None, auto_sync_vfs=True)
¶Initialize RuleSet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | None
|
Path to YAML/JSON config file (optional) |
None
|
auto_sync_vfs
|
bool
|
Automatically mark dirty when changes occur |
True
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
activate_tool_group(group_name)
¶Mark a tool group as active
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
344 345 346 347 348 | |
add_rule(situation, intent, instructions, required_tool_groups=None, preconditions=None, postconditions=None, rule_id=None, learned=False, confidence=1.0)
¶Add a new situation rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
situation
|
str
|
Context description |
required |
intent
|
str
|
What user wants to achieve |
required |
instructions
|
list[str]
|
Step-by-step guidance |
required |
required_tool_groups
|
list[str] | None
|
Tool groups needed |
None
|
preconditions
|
list[str] | None
|
Conditions that must be true |
None
|
postconditions
|
list[str] | None
|
Expected results |
None
|
rule_id
|
str | None
|
Optional custom ID |
None
|
learned
|
bool
|
True if learned at runtime |
False
|
confidence
|
float
|
Initial confidence |
1.0
|
Returns:
| Type | Description |
|---|---|
SituationRule
|
Created SituationRule |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
build_vfs_content()
¶Build VFS file content for agent visibility. This is what the agent sees in the context window.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | |
clear_situation()
¶Clear current situation and intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
416 417 418 419 420 421 422 | |
confirm_suggestion()
¶Confirm pending suggestion and apply it
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
400 401 402 403 404 405 406 407 408 409 410 | |
deactivate_tool_group(group_name)
¶Mark a tool group as inactive
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
350 351 352 353 | |
expand_group(group_name)
¶Expand a tool group to its actual tool names. Used when agent decides to use a tool group.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
335 336 337 338 339 340 341 342 | |
from_checkpoint(data)
¶Restore from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
get_active_rules()
¶Get rules matching current situation/intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
526 527 528 529 530 531 | |
get_current_rule_set()
¶Get complete current rule set state. Used for inspection and debugging.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
get_groups_for_intent(intent)
¶Get tool groups that match the given intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
325 326 327 328 329 330 331 332 333 | |
get_relevant_patterns(situation=None, min_confidence=0.3, limit=10)
¶Get patterns relevant to the given or current situation.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
get_rule(rule_id)
¶Get rule by ID
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
499 500 501 | |
get_vfs_filename()
¶Get VFS filename for this rule set
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
789 790 791 | |
is_dirty()
¶Check if VFS content needs update
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
793 794 795 | |
learn_pattern(pattern, source_situation=None, confidence=0.5, category='general', tags=None)
¶Learn a new pattern from runtime experience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
The information learned |
required |
source_situation
|
str | None
|
Where it was learned (default: current) |
None
|
confidence
|
float
|
Initial confidence |
0.5
|
category
|
str
|
Pattern category |
'general'
|
tags
|
list[str] | None
|
Optional tags for matching |
None
|
Returns:
| Type | Description |
|---|---|
LearnedPattern
|
Created LearnedPattern |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
load_config(path)
¶Load configuration from YAML or JSON file.
Expected format:
tool_groups:
- name: discord_tools
display_name: Discord Server APIs
tool_names: [discord_send, discord_create, ...]
trigger_keywords: [discord, server, bot]
priority: 3
rules:
- situation: working on discord server api
intent: create welcome message
instructions:
- First gather info about message formatting
- Create draft and test once
- Ask human for validation
- Only after approval: save permanently
required_tool_groups: [discord_tools]
patterns:
- pattern: Discord embeds need title, description, color
category: api
confidence: 0.8
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
mark_clean()
¶Mark as synced with VFS
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
802 803 804 | |
match_rules(situation, intent, min_score=0.3)
¶Find rules that match the given situation and intent.
Returns list of matching rules sorted by match score.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
prune_low_confidence_patterns(threshold=0.2)
¶Remove patterns below confidence threshold. Returns count of removed patterns.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
record_rule_failure(rule_id)
¶Record failed rule application
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
543 544 545 546 547 | |
record_rule_success(rule_id)
¶Record successful rule application
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
537 538 539 540 541 | |
register_tool_group(name, display_name, tool_names, trigger_keywords, description='', priority=5, icon='🔧', auto_generated=False)
¶Register a new tool group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Internal name (e.g., "discord_tools") |
required |
display_name
|
str
|
Display name (e.g., "Discord Server APIs") |
required |
tool_names
|
list[str]
|
List of actual tool names in registry |
required |
trigger_keywords
|
list[str]
|
Keywords that activate this group |
required |
description
|
str
|
Short description |
''
|
priority
|
int
|
Sort priority (1=highest) |
5
|
icon
|
str
|
Display icon |
'🔧'
|
auto_generated
|
bool
|
True if from ToolManager category |
False
|
Returns:
| Type | Description |
|---|---|
ToolGroup
|
Created ToolGroup |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
register_tool_groups_from_categories(category_tools, category_descriptions=None)
¶Auto-generate tool groups from ToolManager categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_tools
|
dict[str, list[str]]
|
Dict mapping category -> list of tool names |
required |
category_descriptions
|
dict[str, str] | None
|
Optional descriptions per category |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
reject_suggestion()
¶Reject pending suggestion
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
412 413 414 | |
remove_rule(rule_id)
¶Remove a rule by ID
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
478 479 480 481 482 483 484 | |
rule_on_action(action, context=None)
¶Evaluate if an action is allowed based on current rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
The action being attempted (e.g., "save_permanent", "delete") |
required |
context
|
dict[str, Any] | None
|
Additional context (e.g., {"tool": "discord_save", "validated": False}) |
None
|
Returns:
| Type | Description |
|---|---|
RuleResult
|
RuleResult with allowed status and instructions |
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | |
save_config(path)
¶Save current configuration to file
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | |
set_situation(situation, intent)
¶Set current situation and intent. This updates the VFS file and activates relevant tool groups.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
suggest_situation(situation, intent)
¶System suggests a situation/intent (L1: Hybrid approach). Agent must confirm before it takes effect.
Returns suggestion dict that can be confirmed or rejected.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
to_checkpoint()
¶Serialize for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | |
unregister_tool_group(name)
¶Remove a tool group
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
316 317 318 319 320 321 322 323 | |
update_rule(rule_id, **updates)
¶Update a rule's attributes
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
486 487 488 489 490 491 492 493 494 495 496 497 | |
SituationRule
dataclass
¶Defines behavior rules for specific situation + intent combinations.
Example
situation: "working on discord server api" intent: "create welcome message" instructions: [ "First gather info about message formatting requirements", "Create draft and test once in sandbox", "Ask human for validation before proceeding", "Only after explicit approval: save permanently" ]
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
matches(situation, intent)
¶Calculate match score for given situation and intent. Returns 0.0-1.0 match score.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
record_usage(success)
¶Record usage for learning
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
114 115 116 117 118 119 120 121 122 123 124 | |
ToolGroup
dataclass
¶Groups multiple tools under a single display name. Instead of showing 50 Discord tools, show "discord_tools: Discord Server APIs"
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
matches_intent(intent)
¶Check if this group matches the given intent
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
41 42 43 44 | |
to_display_line(active=False)
¶Generate display line for VFS
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
46 47 48 49 | |
auto_group_tools_by_name_pattern(tool_manager, rule_set, min_group_size=2, separator='_', ignore_prefixes=None, ignore_suffixes=None)
¶Automatically create tool groups based on repeating patterns in tool names.
Analyzes all registered tools and groups them by common prefixes/patterns. Creates RuleSet tool groups for each discovered pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_manager
|
ToolManager
|
ToolManager instance with registered tools |
required |
rule_set
|
RuleSet
|
RuleSet instance for group registration |
required |
min_group_size
|
int
|
Minimum tools needed to form a group (default: 2) |
2
|
separator
|
str
|
Separator character in tool names (default: "_") |
'_'
|
ignore_prefixes
|
list[str]
|
Prefixes to ignore when grouping (e.g., ["mcp", "a2a"]) |
None
|
ignore_suffixes
|
list[str]
|
Suffixes to ignore (e.g., ["tool", "helper"]) |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
Dict mapping group_name -> list of tool names |
Example
Tools: discord_send, discord_edit, discord_delete, github_clone, github_push Result: { "discord_tools": ["discord_send", "discord_edit", "discord_delete"], "github_tools": ["github_clone", "github_push"] }
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | |
create_default_ruleset(config_path=None)
¶Create a RuleSet with sensible defaults.
Source code in toolboxv2/mods/isaa/base/Agent/rule_set.py
1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | |
session_manager
¶
SessionManager V2 - Manages all AgentSessions for FlowAgent
Provides: - Lazy loading of memory instance - Session lifecycle management (V2 with Docker/LSP support) - Bulk operations on sessions
Author: FlowAgent V2
SessionManager
¶Manages all sessions for a FlowAgent instance.
Features: - Lazy loading of AISemanticMemory - Session creation/retrieval/cleanup - Auto-cleanup of inactive sessions - V2: Docker and LSP support
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
__init__(agent_name, default_max_history=100, vfs_max_window_lines=250, rule_config_path=None, summarizer=None, auto_cleanup_hours=None, enable_lsp=True, enable_docker=False, docker_config=None, toolboxv2_wheel_path=None)
¶Initialize SessionManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
str
|
Name of parent agent |
required |
default_max_history
|
int
|
Default history length for new sessions |
100
|
vfs_max_window_lines
|
int
|
Max VFS window lines |
250
|
rule_config_path
|
str | None
|
Default RuleSet config path |
None
|
summarizer
|
Callable | None
|
Summarizer function for VFS |
None
|
auto_cleanup_hours
|
float | None
|
Auto-cleanup sessions older than this |
None
|
enable_lsp
|
bool
|
Enable LSP for new sessions (default: True) |
True
|
enable_docker
|
bool
|
Enable Docker for new sessions (default: False) |
False
|
docker_config
|
DockerConfig | None
|
Docker configuration for new sessions |
None
|
toolboxv2_wheel_path
|
str | None
|
Path to ToolboxV2 wheel for Docker |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
cleanup_docker_containers()
async
¶Clean up all Docker containers from sessions.
Returns:
| Type | Description |
|---|---|
int
|
Number of containers destroyed |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
230 231 232 233 234 235 236 237 238 239 240 241 242 | |
cleanup_inactive(max_idle_hours=None)
async
¶Clean up sessions that have been idle too long.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_idle_hours
|
float | None
|
Max idle time (uses auto_cleanup_hours if None) |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of sessions cleaned up |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
close_all()
async
¶Close all sessions
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
182 183 184 185 | |
close_session(session_id)
async
¶Close and remove a session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Session to close |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if session was closed |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
exists(session_id)
¶Check if session exists
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
159 160 161 | |
from_checkpoint(data)
async
¶Restore sessions from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Checkpoint data |
required |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
get(session_id)
¶Get session by ID (None if not exists)
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
155 156 157 | |
get_all_active()
¶Get all active (initialized) sessions
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
195 196 197 | |
get_docker_sessions()
¶Get all sessions with Docker enabled
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
199 200 201 | |
get_or_create(session_id, max_history=None, rule_config_path=None, enable_lsp=None, enable_docker=None, docker_config=None)
async
¶Get existing session or create new one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Session identifier |
required |
max_history
|
int | None
|
Override default max history |
None
|
rule_config_path
|
str | None
|
Override default rule config |
None
|
enable_lsp
|
bool | None
|
Override default LSP setting |
None
|
enable_docker
|
bool | None
|
Override default Docker setting |
None
|
docker_config
|
DockerConfig | None
|
Override default Docker config |
None
|
Returns:
| Type | Description |
|---|---|
AgentSessionV2
|
AgentSessionV2 instance (initialized) |
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
get_stats()
¶Get session manager statistics
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
list_sessions()
¶List all session IDs
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
187 188 189 | |
to_checkpoint()
¶Serialize all sessions for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/session_manager.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
tool_manager
¶
ToolManager - Unified Tool Registry for FlowAgent
Provides: - Single registry for all tools (local, MCP, A2A) - Category-based organization with flags - Native LiteLLM format support - RuleSet integration for automatic tool grouping
Author: FlowAgent V2
ToolEntry
dataclass
¶Unified tool entry supporting local functions, MCP tools, and A2A tools.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
__post_init__()
¶Ensure defaults and build schema
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
56 57 58 59 60 61 62 63 64 65 66 | |
has_category(category)
¶Check if tool belongs to category
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
106 107 108 | |
has_flag(flag_name)
¶Check if tool has a specific flag enabled
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
102 103 104 | |
matches_categories(categories)
¶Check if tool matches any of the given categories
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
110 111 112 | |
matches_flags(**flags)
¶Check if tool matches all given flag conditions
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
114 115 116 117 118 119 | |
record_call()
¶Record that this tool was called
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
97 98 99 100 | |
ToolManager
¶Unified tool registry managing local, MCP, and A2A tools.
Features: - Single registry for all tool types - Category and flag-based filtering - Native LiteLLM format support - Automatic RuleSet integration
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
__init__(rule_set=None)
¶Initialize ToolManager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_set
|
RuleSet | None
|
Optional RuleSet for automatic tool group registration |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
count()
¶Get total number of registered tools
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
488 489 490 | |
execute(name, **kwargs)
async
¶Execute a tool by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Tool name |
required |
**kwargs
|
Arguments to pass to the tool |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
Tool execution result |
Raises:
| Type | Description |
|---|---|
ValueError
|
If tool not found |
RuntimeError
|
If tool has no function (MCP/A2A) |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
exists(name)
¶Check if tool exists
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
484 485 486 | |
export_for_display()
¶Export registry in human-readable format. Useful for debugging and status displays.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
from_checkpoint(data, function_registry=None)
¶Restore registry from checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Checkpoint data |
required |
function_registry
|
dict[str, Callable] | None
|
Optional dict mapping tool names to functions (for restoring local tool functions) |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | |
get(name)
¶Get tool entry by name
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
412 413 414 | |
get_all()
¶Get all registered tools
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
472 473 474 | |
get_all_litellm(filter_categories=None, filter_flags=None, exclude_categories=None, max_tools=None)
¶Get all tools in LiteLLM format with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_categories
|
list[str] | None
|
Only include tools with these categories |
None
|
filter_flags
|
dict[str, bool] | None
|
Only include tools matching these flag conditions |
None
|
exclude_categories
|
list[str] | None
|
Exclude tools with these categories |
None
|
max_tools
|
int | None
|
Maximum number of tools to return |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of tool schemas in LiteLLM format |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
get_by_category(*categories)
¶Get tools matching any of the given categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*categories
|
str
|
Category names to match |
()
|
Returns:
| Type | Description |
|---|---|
list[ToolEntry]
|
List of matching ToolEntries |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
get_by_flags(**flags)
¶Get tools matching all given flag conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**flags
|
bool
|
Flag conditions (e.g., read=True, dangerous=False) |
{}
|
Returns:
| Type | Description |
|---|---|
list[ToolEntry]
|
List of matching ToolEntries |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
get_by_source(source)
¶Get tools by source (local, mcp, a2a)
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
466 467 468 469 470 | |
get_function(name)
¶Get tool function by name
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
416 417 418 419 | |
get_litellm_schema(name)
¶Get cached LiteLLM schema for a tool
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
508 509 510 511 512 513 | |
get_stats()
¶Get registry statistics
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
492 493 494 495 496 497 498 499 500 501 502 | |
list_categories()
¶Get list of all categories
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
480 481 482 | |
list_names()
¶Get list of all tool names
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
476 477 478 | |
register(func, name=None, description=None, category=None, flags=None, source='local', server_name=None, metadata=None, args_schema=None)
¶Register a tool in the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable | None
|
The callable function (can be None for MCP/A2A stubs) |
required |
name
|
str | None
|
Tool name (defaults to function name) |
None
|
description
|
str | None
|
Tool description (defaults to docstring) |
None
|
category
|
list[str] | str | None
|
Category or list of categories |
None
|
flags
|
dict[str, bool] | None
|
Dict of flags (read, write, dangerous, etc.) |
None
|
source
|
str
|
Tool source ('local', 'mcp', 'a2a') |
'local'
|
server_name
|
str | None
|
For MCP/A2A: the server name |
None
|
metadata
|
dict[str, Any] | None
|
Additional metadata |
None
|
args_schema
|
str | None
|
Override args schema string |
None
|
Returns:
| Type | Description |
|---|---|
ToolEntry
|
Created ToolEntry |
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
register_a2a_tools(server_name, tools, category_prefix='a2a')
¶Register multiple A2A tools from a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_name
|
str
|
Name of the A2A server |
required |
tools
|
list[dict[str, Any]]
|
List of tool configs from A2A server |
required |
category_prefix
|
str
|
Prefix for category (default: "a2a") |
'a2a'
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
register_mcp_tools(server_name, tools, category_prefix='mcp')
¶Register multiple MCP tools from a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_name
|
str
|
Name of the MCP server |
required |
tools
|
list[dict[str, Any]]
|
List of tool configs from MCP server Each should have: name, description, inputSchema |
required |
category_prefix
|
str
|
Prefix for category (default: "mcp") |
'mcp'
|
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
set_ruleset(rule_set)
¶Set RuleSet for automatic tool group registration
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
826 827 828 829 830 | |
to_checkpoint()
¶Serialize registry for checkpoint. Note: Function references are NOT serialized.
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | |
unregister(name)
¶Remove a tool from the registry
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
update(name, **updates)
¶Update a tool's attributes
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
create_tool_manager(rule_set=None)
¶Create a ToolManager with optional RuleSet integration
Source code in toolboxv2/mods/isaa/base/Agent/tool_manager.py
1002 1003 1004 | |
types
¶
AgentCheckpoint
dataclass
¶Enhanced AgentCheckpoint with UnifiedContextManager and ChatSession integration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
get_checkpoint_summary()
¶Get human-readable checkpoint summary
Source code in toolboxv2/mods/isaa/base/Agent/types.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | |
get_storage_size_estimate()
¶Estimate storage size of different checkpoint components
Source code in toolboxv2/mods/isaa/base/Agent/types.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | |
get_version_info()
¶Get checkpoint version information
Source code in toolboxv2/mods/isaa/base/Agent/types.py
719 720 721 722 723 724 725 726 727 728 | |
validate_checkpoint_integrity()
¶Validate checkpoint integrity and completeness
Source code in toolboxv2/mods/isaa/base/Agent/types.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
AgentModelData
¶
Bases: BaseModel
Source code in toolboxv2/mods/isaa/base/Agent/types.py
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | |
get_system_message()
¶Get system message with persona integration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
809 810 811 812 813 | |
ChainMetadata
dataclass
¶Metadata for stored chains
Source code in toolboxv2/mods/isaa/base/Agent/types.py
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | |
CheckpointConfig
¶
Bases: BaseModel
Checkpoint configuration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
15 16 17 18 19 20 21 22 23 | |
DecisionTask
dataclass
¶
Bases: Task
Task für dynamisches Routing
Source code in toolboxv2/mods/isaa/base/Agent/types.py
515 516 517 518 519 520 | |
FormatConfig
dataclass
¶Konfiguration für Response-Format und -Länge
Source code in toolboxv2/mods/isaa/base/Agent/types.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
get_combined_instructions()
¶Kombiniere Format- und Längen-Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
get_expected_word_range()
¶Erwartete Wortanzahl für Qualitätsbewertung
Source code in toolboxv2/mods/isaa/base/Agent/types.py
433 434 435 436 437 438 439 440 441 442 | |
get_format_instructions()
¶Generiere Format-spezifische Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_length_instructions()
¶Generiere Längen-spezifische Anweisungen
Source code in toolboxv2/mods/isaa/base/Agent/types.py
405 406 407 408 409 410 411 412 413 414 | |
LLMTask
dataclass
¶
Bases: Task
Spezialisierter Task für LLM-Aufrufe
Source code in toolboxv2/mods/isaa/base/Agent/types.py
492 493 494 495 496 497 498 499 500 501 502 | |
PersonaConfig
dataclass
¶Source code in toolboxv2/mods/isaa/base/Agent/types.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | |
should_post_process()
¶Check if post-processing should be applied
Source code in toolboxv2/mods/isaa/base/Agent/types.py
784 785 786 | |
to_system_prompt_addition()
¶Convert persona to system prompt addition with format integration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
update_format(response_format, text_length, custom_instructions='')
¶Dynamische Format-Aktualisierung
Source code in toolboxv2/mods/isaa/base/Agent/types.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
PlanData
¶
Bases: BaseModel
Dataclass for plan data
Source code in toolboxv2/mods/isaa/base/Agent/types.py
523 524 525 526 527 528 | |
ProgressEvent
dataclass
¶Enhanced progress event with better error handling
Source code in toolboxv2/mods/isaa/base/Agent/types.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
from_dict(data)
classmethod
¶Create ProgressEvent from dictionary
Source code in toolboxv2/mods/isaa/base/Agent/types.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
get_chat_display_data()
¶Get data optimized for chat view display
Source code in toolboxv2/mods/isaa/base/Agent/types.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
get_detailed_display_data()
¶Get complete filtered data for detailed popup view
Source code in toolboxv2/mods/isaa/base/Agent/types.py
275 276 277 | |
get_progress_summary()
¶Get a brief summary for progress sidebar
Source code in toolboxv2/mods/isaa/base/Agent/types.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
to_dict()
¶Return event data with None values removed for compact display
Source code in toolboxv2/mods/isaa/base/Agent/types.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
ProgressTracker
¶Advanced progress tracking with cost calculation and memory leak prevention
Source code in toolboxv2/mods/isaa/base/Agent/types.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
calculate_llm_cost(model, input_tokens, output_tokens, completion_response=None)
¶Calculate approximate LLM cost
Source code in toolboxv2/mods/isaa/base/Agent/types.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
emit_event(event)
async
¶Emit progress event with callback and storage (sliding window to prevent memory leak)
Source code in toolboxv2/mods/isaa/base/Agent/types.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
end_timer(key)
¶End timing operation and return duration
Source code in toolboxv2/mods/isaa/base/Agent/types.py
338 339 340 341 342 343 344 | |
get_summary()
¶Get comprehensive progress summary
Source code in toolboxv2/mods/isaa/base/Agent/types.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
start_timer(key)
¶Start timing operation
Source code in toolboxv2/mods/isaa/base/Agent/types.py
332 333 334 335 336 | |
Task
dataclass
¶Source code in toolboxv2/mods/isaa/base/Agent/types.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
__post_init__()
¶Ensure all mutable defaults are properly initialized
Source code in toolboxv2/mods/isaa/base/Agent/types.py
466 467 468 469 470 471 472 473 | |
ToolAnalysis
¶
Bases: BaseModel
Defines the structure for a valid tool analysis.
Source code in toolboxv2/mods/isaa/base/Agent/types.py
816 817 818 819 820 821 822 823 824 825 826 | |
ToolTask
dataclass
¶
Bases: Task
Spezialisierter Task für Tool-Aufrufe
Source code in toolboxv2/mods/isaa/base/Agent/types.py
505 506 507 508 509 510 511 512 | |
create_task(task_type, **kwargs)
¶Factory für Task-Erstellung mit korrektem Typ
Source code in toolboxv2/mods/isaa/base/Agent/types.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
utils
¶
LLMMessage
dataclass
¶Represents a message in a conversation with the LLM.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
to_dict()
¶Convert to dictionary, handling potential dataclass nuances.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
144 145 146 147 148 149 150 151 | |
WorldModel
dataclass
¶Thread-safe representation of the agent's persistent understanding of the world.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
vfs_v2
¶
VirtualFileSystem V2 - Enhanced VFS with Directories, FileTypes, and LSP Integration
Features: - Hierarchical directory structure (mkdir, rmdir, mv, ls) - File type detection with LSP integration - Executable flag for runnable files - Token-efficient context management
Author: FlowAgent V2
FileCategory
¶
Bases: Enum
High-level file categories
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
30 31 32 33 34 35 36 37 38 | |
FileTypeInfo
dataclass
¶Information about a file type
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
41 42 43 44 45 46 47 48 49 50 51 | |
VFSDirectory
dataclass
¶Represents a directory in the Virtual File System
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
177 178 179 180 181 182 183 | |
VFSFile
dataclass
¶Represents a file in the Virtual File System
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
__post_init__()
¶Initialize file type info
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
169 170 171 172 173 174 | |
VirtualFileSystemV2
¶Virtual File System V2 with hierarchical directories and LSP integration.
Features: - Hierarchical directory structure - open/closed states (only open files show in context) - Windowing (show only specific line ranges) - System files (read-only, auto-updated) - File type detection with LSP support - Auto-summary on close
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | |
append(path, content)
¶Append to file
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
build_context_string()
¶Build VFS context string for LLM
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
can_execute(path)
¶Check if file can be executed
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
1118 1119 1120 1121 1122 1123 | |
close(path)
async
¶Close file (create summary, remove from context)
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | |
create(path, content='')
¶Create a new file
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
delete(path)
¶Delete a file
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
edit(path, line_start, line_end, new_content)
¶Edit file by replacing lines (1-indexed)
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
from_checkpoint(data)
¶Restore VFS from checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
get_diagnostics(path, force_refresh=False)
async
¶Get LSP diagnostics for a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
File path |
required |
force_refresh
|
bool
|
If True, refresh diagnostics from LSP server |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with diagnostics |
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | |
get_executable_files()
¶Get list of executable files
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
get_file_info(path)
¶Get file metadata without content
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
list_files()
¶List all files with metadata (legacy compatibility)
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | |
load_from_local(local_path, vfs_path=None, allowed_dirs=None, max_size_bytes=1024 * 1024)
¶Safely load a local file into VFS
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | |
ls(path='/', recursive=False, show_hidden=False)
¶List directory contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path to list |
'/'
|
recursive
|
bool
|
If True, list recursively |
False
|
show_hidden
|
bool
|
If True, show hidden files (starting with .) |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with directory contents |
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
mkdir(path, parents=False)
¶Create a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path to create |
required |
parents
|
bool
|
If True, create parent directories as needed |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
mv(source, destination)
¶Move/rename a file or directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Source path |
required |
destination
|
str
|
Destination path |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
open(path, line_start=1, line_end=-1)
¶Open file (make content visible in context)
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
read(path)
¶Read file content
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
602 603 604 605 606 607 608 609 610 611 | |
rmdir(path, force=False)
¶Remove a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path to remove |
required |
force
|
bool
|
If True, remove non-empty directories recursively |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Result dict with success status |
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
save_to_local(vfs_path, local_path, allowed_dirs=None, overwrite=False, create_dirs=True)
¶Safely save a VFS file to local filesystem
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | |
set_rules_file(content)
¶Set the active_rules file content (from RuleSet)
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
to_checkpoint()
¶Serialize VFS for checkpoint
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | |
update_system_context()
¶Refresh system context
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
249 250 251 252 253 254 | |
view(path, line_start=1, line_end=-1)
¶View/adjust visible window
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | |
write(path, content)
¶Write/overwrite file content
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
get_file_type(filename)
¶Get file type info from filename
Source code in toolboxv2/mods/isaa/base/Agent/vfs_v2.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
web_display
¶
WebAppDisplay - Local development demo for web app display
Provides a simple iframe-based display for Docker-hosted web apps. This is a minimal implementation for local development.
For production (simplecor.app), session-based routing will be added.
Author: FlowAgent V2
DisplaySession
dataclass
¶A display session for accessing a web app
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
WebAppDisplay
¶Local development display for Docker-hosted web apps.
Features: - Simple port forwarding for local access - Session token generation - HTML iframe embed code generation
For production use with simplecor.app: - Add session-based routing through nginx/traefik - Implement proper authentication - Use secure tokens with expiration
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
__init__(config=None)
¶Initialize WebAppDisplay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
WebDisplayConfig | None
|
Display configuration |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
cleanup()
¶Clean up all sessions and release ports
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
498 499 500 501 502 | |
close_session(session_id)
¶Close a display session
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
206 207 208 209 210 211 212 213 214 215 216 | |
create_session(container_url, timeout_minutes=None)
¶Create a display session for a container app.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container_url
|
str
|
URL of the app inside the container (e.g., http://localhost:8080) |
required |
timeout_minutes
|
int | None
|
Session timeout (default from config) |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Session info with access URL |
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
generate_full_html_page(session_id, title='VFS Web App')
¶Generate a full HTML page with the iframe
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
generate_simplecor_config(session_id)
¶Generate configuration for SimpleCor.app integration.
This is a placeholder for future production deployment. The actual implementation will depend on SimpleCor's routing setup.
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
get_session(session_id)
¶Get a session by ID
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
199 200 201 202 203 204 | |
list_sessions()
¶List all active sessions
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
start_simple_proxy(session_id)
async
¶Start a simple HTTP proxy for local development.
This is a basic implementation for local testing. For production, use nginx/traefik with proper routing.
Note: This requires aiohttp. Falls back to direct URL if not available.
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
WebDisplayConfig
dataclass
¶Configuration for web app display
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
28 29 30 31 32 33 34 35 36 | |
create_web_display_for_docker(docker_vfs, entrypoint, title='VFS Web App')
async
¶Helper function to start a web app and create a display session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
docker_vfs
|
'DockerVFS'
|
DockerVFS instance |
required |
entrypoint
|
str
|
Command to start the web app |
required |
title
|
str
|
Display title |
'VFS Web App'
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with display info and HTML page |
Source code in toolboxv2/mods/isaa/base/Agent/web_display.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
AgentKnowledgeActor
¶
AgentKnowledge
¶
An agent that orchestrates the use of a KnowledgeBase by dynamically selecting tools in a loop using an LLM to analyze a given topic.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
__init__(kb)
¶Initializes the agent with a KnowledgeBase instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kb
|
KnowledgeBase
|
An initialized KnowledgeBase object. |
required |
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
31 32 33 34 35 36 37 38 39 40 | |
add_data_point(text, metadata=None)
async
¶Adds a new data point (chunk) to the Knowledge Base.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
81 82 83 84 85 86 | |
add_relation(source_concept, target_concept, relation_type)
async
¶Adds a new relationship between two concepts in the graph.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
93 94 95 96 97 98 99 100 101 102 | |
combine_2_data_points(query1, query2)
async
¶Retrieves two data points, summarizes them into a new one, and adds it to the KB.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
final_analysis(summary)
¶Signals the end of the analysis loop and provides the final summary. This is a special tool that stops the loop.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
181 182 183 184 185 186 | |
get_common_relations(concept)
async
¶Finds all relationships associated with a given concept.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
160 161 162 163 164 165 166 | |
get_largest_cluster_points(query)
async
¶Finds the largest topic cluster related to a query and returns its summary and main chunks.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
138 139 140 141 142 143 144 | |
get_single_points(query)
async
¶Retrieves highly relevant individual data points (chunks) for a query.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
155 156 157 158 | |
get_smallest_cluster_points(query)
async
¶Finds the smallest (but not single-point) topic cluster related to a query.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
146 147 148 149 150 151 152 153 | |
get_uncommon_relations(concept1, concept2)
async
¶Finds relationships that one concept has but the other does not.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
168 169 170 171 172 173 174 175 176 177 178 179 | |
remove_data_point(concept_to_remove)
async
¶Removes data points related to a specific concept.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
88 89 90 91 | |
remove_relation(source_concept, target_concept, relation_type)
async
¶Removes a relationship between two concepts.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
104 105 106 107 108 109 110 111 112 113 | |
start_analysis_loop(user_task, max_iterations=10)
async
¶Starts the dynamic analysis loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_task
|
str
|
The initial user query or topic to analyze. |
required |
max_iterations
|
int
|
The maximum number of tool calls to prevent infinite loops. |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
The complete history of the analysis. |
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
ToolCall
¶
Bases: BaseModel
Defines the structure for a tool call requested by the LLM.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
19 20 21 22 | |
agent_main()
async
¶
Example usage of the AgentKnowledge class.
Source code in toolboxv2/mods/isaa/base/AgentKnowledgeActor.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
AgentUtils
¶
AISemanticMemory
¶
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
__init__(base_path='/semantic_memory', default_model=os.getenv('BLITZMODEL'), default_embedding_model=os.getenv('DEFAULTMODELEMBEDDING'), default_similarity_threshold=0.61, default_batch_size=64, default_n_clusters=2, default_deduplication_threshold=0.85)
¶Initialize AISemanticMemory with KnowledgeBase integration
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_path
|
str
|
Root directory for memory storage |
'/semantic_memory'
|
default_model
|
str
|
Default model for text generation |
getenv('BLITZMODEL')
|
default_embedding_model
|
str
|
Default embedding model |
getenv('DEFAULTMODELEMBEDDING')
|
default_similarity_threshold
|
float
|
Default similarity threshold for retrieval |
0.61
|
default_batch_size
|
int
|
Default batch size for processing |
64
|
default_n_clusters
|
int
|
Default number of clusters for FAISS |
2
|
default_deduplication_threshold
|
float
|
Default threshold for deduplication |
0.85
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
add_data(memory_name, data, metadata=None, direct=False)
async
¶Add data to memory store
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
memory_name
|
str
|
Target memory store |
required |
data
|
str | list[str] | bytes | dict
|
Text, list of texts, binary file, or structured data |
required |
metadata
|
dict | None
|
Optional metadata |
None
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
create_memory(name, model_config=None, storage_config=None)
¶Create new memory store with KnowledgeBase
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique name for the memory store |
required |
model_config
|
dict | None
|
Configuration for embedding model |
None
|
storage_config
|
dict | None
|
Configuration for KnowledgeBase parameters |
None
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
delete_memory(name)
async
¶Delete a memory store
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
542 543 544 545 546 547 548 | |
list_memories()
¶List all available memories
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
538 539 540 | |
load_all_memories(path)
¶Load all memory stores from disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 | |
load_memory(name, path)
¶Load a memory store from disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
592 593 594 595 596 597 598 599 600 601 602 | |
query(query, memory_names=None, query_params=None, to_str=False, unified_retrieve=False)
async
¶Query memories using KnowledgeBase retrieval
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query |
required |
memory_names
|
str | list[str] | None
|
Target memory names |
None
|
query_params
|
dict | None
|
Query parameters |
None
|
to_str
|
bool
|
Return string format |
False
|
unified_retrieve
|
bool
|
Unified retrieve |
False
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
save_all_memories(path)
¶Save all memory stores to disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
567 568 569 570 571 572 573 574 575 | |
save_memory(name, path)
¶Save a memory store to disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
550 551 552 553 554 555 556 557 558 559 | |
PyEnvEval
¶
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | |
run_and_display(python_code)
¶function to eval python code
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
803 804 805 806 807 808 | |
anything_from_str_to_dict(data, expected_keys=None, mini_task=lambda x: '')
¶
Versucht, einen String in ein oder mehrere Dictionaries umzuwandeln. Berücksichtigt dabei die erwarteten Schlüssel und ihre Standardwerte.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | |
complete_json_object(data, mini_task)
¶
Ruft eine Funktion auf, um einen String in das richtige Format zu bringen. Gibt das resultierende JSON-Objekt zurück, wenn die Funktion erfolgreich ist, sonst None.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | |
detect_shell()
¶
Detects the best available shell and the argument to execute a command. Returns: A tuple of (shell_executable, command_argument). e.g., ('/bin/bash', '-c') or ('powershell.exe', '-Command')
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
extract_text_natively(data, filename='')
¶
Extrahiert Text aus verschiedenen Dateitypen mit nativen Python-Methoden oder reinen Python-Bibliotheken (speziell PyPDF2 für PDFs).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Der Inhalt der Datei als Bytes. |
required |
filename
|
str
|
Der Originaldateiname, um den Typ zu bestimmen. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Der extrahierte Text. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Wenn der Dateityp nicht unterstützt wird oder die Verarbeitung fehlschlägt. |
ImportError
|
Wenn PyPDF2 für die Verarbeitung von PDF-Dateien benötigt, aber nicht installiert ist. |
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
find_json_objects_in_str(data)
¶
Sucht nach JSON-Objekten innerhalb eines Strings. Gibt eine Liste von JSON-Objekten zurück, die im String gefunden wurden.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1236 1237 1238 1239 1240 1241 1242 1243 1244 | |
get_json_from_json_str(json_str, repeat=1)
¶
Versucht, einen JSON-String in ein Python-Objekt umzuwandeln.
Wenn beim Parsen ein Fehler auftritt, versucht die Funktion, das Problem zu beheben,
indem sie das Zeichen an der Position des Fehlers durch ein Escape-Zeichen ersetzt.
Dieser Vorgang wird bis zu repeat-mal wiederholt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_str
|
str or list or dict
|
Der JSON-String, der geparst werden soll. |
required |
repeat
|
int
|
Die Anzahl der Versuche, das Parsen durchzuführen. |
1
|
Returns:
| Type | Description |
|---|---|
dict or None
|
Das resultierende Python-Objekt. |
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | |
parse_json_with_auto_detection(json_data)
¶
Parses JSON data, automatically detecting if a value is a JSON string and parsing it accordingly. If a value cannot be parsed as JSON, it is returned as is.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | |
IntelligentRateLimiter
¶
intelligent_rate_limiter
¶
Intelligenter, selbst-adaptierender LLM Rate Limiter v2
Features: - Automatische Extraktion von Rate-Limit-Informationen aus Fehlerantworten - Provider- und modellspezifische Konfiguration - Token-basiertes Rate Limiting (nicht nur Request-basiert) - Exponential Backoff mit Jitter - Persistente Limit-Datenbank für bekannte Provider/Modelle - Dynamische Anpassung basierend auf tatsächlichem Verhalten
NEW v2: - Model Fallback Chains: Automatischer Wechsel zu Fallback-Modellen bei Limit - Multi-API-Key Management mit Drain/Balance Modi - Kombinierbare Strategien: Key-Rotation + Model-Fallback - Minimale Konfiguration erforderlich
APIKeyInfo
dataclass
¶Information über einen API-Key
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
APIKeyManager
¶Verwaltet mehrere API-Keys pro Provider.
Features: - Drain Mode: Ein Key bis Limit, dann nächster - Balance Mode: Round-Robin über alle Keys - Automatische Key-Rotation bei Limits - Per-Key Tracking
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
add_key(provider, key, priority=0, custom_rpm=None, custom_tpm=None)
¶Füge einen API-Key hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider-Name (z.B. "vertex_ai", "openai") |
required |
key
|
str
|
Der API-Key |
required |
priority
|
int
|
Niedrigere Zahl = höhere Priorität |
0
|
custom_rpm
|
Optional[int]
|
Optionales custom RPM-Limit für diesen Key |
None
|
custom_tpm
|
Optional[int]
|
Optionales custom TPM-Limit für diesen Key |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Key-Hash für Referenz |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
get_all_keys(provider)
¶Hole alle Keys für einen Provider
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
319 320 321 | |
get_next_key(provider)
async
¶Hole den nächsten verfügbaren API-Key.
Berücksichtigt: - Globalen Key-Modus (Drain/Balance) - Exhausted Status - Priorität
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
get_stats(provider=None)
¶Hole Statistiken über alle Keys
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
323 324 325 326 327 328 329 | |
mark_key_exhausted(provider, key_hash, duration=60.0, advance_to_next=True)
¶Markiere einen Key als temporär exhausted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider-Name |
required |
key_hash
|
str
|
Hash des Keys |
required |
duration
|
float
|
Wie lange der Key exhausted ist (Sekunden) |
60.0
|
advance_to_next
|
bool
|
Bei Drain-Mode zum nächsten Key wechseln |
True
|
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
mark_key_used(provider, key_hash, tokens=0)
¶Registriere Key-Nutzung
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
308 309 310 311 312 313 314 315 316 317 | |
remove_key(provider, key_hash)
¶Entferne einen API-Key
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
235 236 237 238 239 240 241 242 243 244 | |
FallbackReason
¶
Bases: Enum
Grund für Fallback
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
55 56 57 58 59 60 | |
FallbackState
dataclass
¶Aktueller Fallback-Zustand für ein Model
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
142 143 144 145 146 147 148 149 150 | |
IntelligentRateLimiter
¶Intelligenter Rate Limiter der sich automatisch an Provider-Limits anpasst.
v2 Features: - Model Fallback Chains - Multi-API-Key Management - Kombinierbare Strategien
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | |
acquire(model, estimated_input_tokens=0, estimated_output_tokens=0)
async
¶Warte bis ein Request erlaubt ist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Model-String (kann Provider enthalten wie "vertex_ai/gemini-1.5-pro") |
required |
estimated_input_tokens
|
int
|
Geschätzte Input-Tokens |
0
|
estimated_output_tokens
|
int
|
Geschätzte Output-Tokens |
0
|
Returns:
| Type | Description |
|---|---|
Tuple[str, Optional[str]]
|
(active_model, api_key) - Das tatsächlich zu verwendende Model und ggf. API-Key |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | |
add_api_key(provider, key, priority=0, custom_rpm=None, custom_tpm=None)
¶Füge einen API-Key hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
z.B. "vertex_ai", "openai", "anthropic" |
required |
key
|
str
|
Der API-Key |
required |
priority
|
int
|
Niedrigere Zahl = höhere Priorität |
0
|
custom_rpm
|
Optional[int]
|
Optionales custom RPM-Limit |
None
|
custom_tpm
|
Optional[int]
|
Optionales custom TPM-Limit |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Key-Hash für Referenz |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | |
add_fallback_chain(primary_model, fallback_models, fallback_duration=60.0)
¶Füge eine komplette Fallback-Chain hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
primary_model
|
str
|
Das primäre Model |
required |
fallback_models
|
List[str]
|
Liste von Fallbacks in Prioritätsreihenfolge |
required |
fallback_duration
|
float
|
Wie lange bleibt Fallback aktiv (Sekunden) |
60.0
|
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | |
add_fallback_model(primary_model, fallback_model)
¶Füge ein Fallback-Model hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
primary_model
|
str
|
z.B. "vertex_ai/gemini-2.5-pro" |
required |
fallback_model
|
str
|
z.B. "vertex_ai/gemini-2.5-flash" |
required |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
846 847 848 849 850 851 852 853 854 855 856 857 858 | |
get_stats(model=None)
¶Hole Statistiken
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
handle_rate_limit_error(model, error, response_body=None, api_key_hash=None)
async
¶Verarbeite einen Rate-Limit-Fehler.
Returns:
| Type | Description |
|---|---|
Tuple[float, Optional[str]]
|
(wait_time, fallback_model) - Wartezeit und ggf. Fallback-Model |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | |
report_success(model, tokens_used=None, api_key_hash=None)
¶Melde einen erfolgreichen Request
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | |
set_key_rotation_mode(mode)
¶Setze den Key-Rotation-Modus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
"drain" (ein Key bis Limit) oder "balance" (Round-Robin) |
required |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
837 838 839 840 841 842 843 844 | |
set_limits(model, rpm=None, rps=None, tpm=None, input_tpm=None, is_free_tier=False)
¶Setze Limits manuell für ein Model
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | |
KeyRotationMode
¶
Bases: Enum
Modi für API-Key Rotation
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
49 50 51 52 | |
LiteLLMRateLimitHandler
¶Intelligenter Handler für LiteLLM mit automatischem Rate Limiting, Model Fallback und Multi-API-Key Support.
Features (alle togglebar): - Rate Limiting mit automatischer Anpassung - Model Fallback bei Limits (z.B. pro -> flash) - Multi-API-Key mit Drain/Balance Modi - Kombinierbare Strategien
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | |
add_api_key(provider, key, **kwargs)
¶Füge einen API-Key hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
"vertex_ai", "openai", "anthropic", etc. |
required |
key
|
str
|
Der API-Key |
required |
Example
handler.add_api_key("vertex_ai", "AIza...")
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | |
add_fallback(primary_model, fallback_model)
¶Füge ein Fallback-Model hinzu.
Example
handler.add_fallback("vertex_ai/gemini-2.5-pro", "vertex_ai/gemini-2.5-flash")
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 | |
add_fallback_chain(primary_model, fallback_models, fallback_duration=60.0)
¶Füge eine Fallback-Chain hinzu.
Example
handler.add_fallback_chain( "vertex_ai/gemini-2.5-pro", ["vertex_ai/gemini-2.5-flash", "vertex_ai/gemini-2.0-flash"], fallback_duration=120.0 )
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | |
completion_with_rate_limiting(litellm_module, wait_callback=None, **kwargs)
async
¶Wrapper für litellm.acompletion mit allen intelligenten Features.
Features (alle automatisch): - Rate Limiting - Model Fallback bei Limits - API Key Rotation - Automatische Retries
Example
response = await handler.completion_with_rate_limiting( litellm, model="vertex_ai/gemini-2.5-pro", messages=[{"role": "user", "content": "Hello!"}], )
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 | |
get_stats(model=None)
¶Hole Statistiken
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1438 1439 1440 | |
rate_limited(model, estimated_tokens=0)
async
¶Context Manager für manuelles Rate Limiting.
Example
async with handler.rate_limited("vertex_ai/gemini-2.5-pro", 1000): # Your API call here pass
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | |
set_key_rotation_mode(mode)
¶Setze den Key-Rotation-Modus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
"drain" (ein Key bis Limit) oder "balance" (Round-Robin) |
required |
Example
handler.set_key_rotation_mode("drain")
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
set_limits(model, **kwargs)
¶Setze Model-Limits manuell
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1434 1435 1436 | |
ModelFallbackConfig
dataclass
¶Konfiguration für Model-Fallback
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
127 128 129 130 131 132 133 134 135 136 137 138 139 | |
ModelFallbackManager
¶Verwaltet Model-Fallback-Chains.
Features: - Automatischer Wechsel zu Fallback bei Rate-Limit - Timed Recovery zu Primary Model - Kaskadierender Fallback (Primary -> Fallback1 -> Fallback2 -> ...)
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
add_fallback_chain(primary_model, fallback_models, fallback_duration=60.0, cooldown_check_interval=10.0, auto_recover=True)
¶Füge eine Fallback-Chain hinzu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
primary_model
|
str
|
Das primäre Model |
required |
fallback_models
|
List[str]
|
Liste von Fallback-Models (in Prioritätsreihenfolge) |
required |
fallback_duration
|
float
|
Wie lange bleibt Fallback aktiv (Sekunden) |
60.0
|
cooldown_check_interval
|
float
|
Wie oft wird Primary gecheckt |
10.0
|
auto_recover
|
bool
|
Automatisch zu Primary zurück wenn verfügbar |
True
|
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
add_fallback_model(primary_model, fallback_model)
¶Füge ein einzelnes Fallback-Model hinzu
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
get_active_model(requested_model)
async
¶Hole das aktuell zu verwendende Model.
Returns:
| Type | Description |
|---|---|
Tuple[str, bool]
|
(active_model, is_fallback) |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
get_fallback_chain(model)
¶Hole die Fallback-Chain für ein Model
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
560 561 562 563 564 | |
get_state(model)
¶Hole den aktuellen Fallback-State
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
reset_fallback(model)
async
¶Setze Fallback-State zurück (manuell oder nach erfolgreicher Recovery)
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
549 550 551 552 553 554 555 556 557 558 | |
trigger_fallback(model, reason=FallbackReason.RATE_LIMIT, duration=None)
async
¶Trigger Fallback für ein Model.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Das neue aktive Model oder None wenn kein Fallback verfügbar |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
ProviderModelLimits
dataclass
¶Rate Limits für ein spezifisches Provider/Model Paar
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
QuotaType
¶
Bases: Enum
Verschiedene Quota-Typen die Provider verwenden
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
38 39 40 41 42 43 44 45 46 | |
RateLimitState
dataclass
¶Aktueller Zustand für ein Provider/Model Paar
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
91 92 93 94 95 96 97 98 99 100 101 | |
create_handler_from_config(config)
¶Erstelle Handler aus Konfiguration.
Config Format: { "features": { "rate_limiting": true, "model_fallback": true, "key_rotation": true, "key_rotation_mode": "drain" // or "balance" }, "api_keys": { "vertex_ai": ["AIza...", "AIzb..."], "openai": ["sk-..."] }, "fallback_chains": { "vertex_ai/gemini-2.5-pro": ["vertex_ai/gemini-2.5-flash"], "openai/gpt-4o": ["openai/gpt-4o-mini"] }, "limits": { "vertex_ai/gemini-2.5-pro": {"rpm": 2, "input_tpm": 32000} } }
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 | |
example_from_config()
async
¶Beispiel mit Config-Datei
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | |
example_usage()
async
¶Beispiel für die Verwendung des intelligenten Rate Limiters v2
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | |
load_handler_from_file(path)
¶Lade Handler-Konfiguration aus JSON/YAML Datei
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/intelligent_rate_limiter.py
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | |
provider_limits
¶
Provider-spezifische Rate Limit Konfigurationen.
Diese Datei enthält detaillierte, aktuelle Rate Limits für verschiedene LLM Provider. Stand: 2024 (aktualisiere bei Bedarf)
Quellen: - OpenAI: https://platform.openai.com/docs/guides/rate-limits - Anthropic: https://docs.anthropic.com/en/api/rate-limits - Google/Vertex: https://ai.google.dev/gemini-api/docs/rate-limits - Groq: https://console.groq.com/docs/rate-limits - Together: https://docs.together.ai/docs/rate-limits
ModelRateLimit
dataclass
¶Rate Limits für ein spezifisches Model
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/provider_limits.py
33 34 35 36 37 38 39 40 41 42 43 44 45 | |
Tier
¶
Bases: Enum
API-Plan Tiers
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/provider_limits.py
20 21 22 23 24 25 26 27 28 29 30 | |
get_limits_for_model(provider, model, tier=Tier.FREE)
¶Hole die Rate Limits für einen Provider/Model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider-Name (openai, anthropic, google, etc.) |
required |
model
|
str
|
Model-Name |
required |
tier
|
Tier
|
API-Tier |
FREE
|
Returns:
| Type | Description |
|---|---|
ModelRateLimit
|
ModelRateLimit oder None |
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/provider_limits.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
print_all_limits()
¶Drucke alle bekannten Limits übersichtlich
Source code in toolboxv2/mods/isaa/base/IntelligentRateLimiter/provider_limits.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
KnowledgeBase
¶
Chunk
dataclass
¶
Represents a chunk of text with its embedding and metadata
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
ConceptAnalysis
¶
Bases: BaseModel
Represents the analysis of key concepts.
Attributes:
| Name | Type | Description |
|---|---|---|
key_concepts |
list[str]
|
A list of primary key concepts identified. |
relationships |
list[str]
|
A list of relationships between the identified key concepts. |
importance_hierarchy |
list[str]
|
A list that represents the hierarchical importance of the key concepts. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
152 153 154 155 156 157 158 159 160 161 162 163 | |
ConceptExtractor
¶
Handles extraction of concepts and relationships from text
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
extract_concepts(texts, metadatas)
async
¶Extract concepts from texts using concurrent processing with rate limiting. Requests are made at the specified rate while responses are processed asynchronously.
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
process_chunks(chunks)
async
¶Process all chunks in batch to extract and store concepts. Each chunk's metadata will be updated with the concept names and relationships.
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
query_concepts(query)
async
¶Query the concept graph based on natural language query
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
ConceptGraph
¶
Manages concept relationships and hierarchies
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
add_concept(concept)
¶Add or update a concept in the graph
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
convert_to_networkx()
¶Convert ConceptGraph to NetworkX graph with layout
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
get_related_concepts(concept_name, relationship_type=None)
¶Get related concepts, optionally filtered by relationship type
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
230 231 232 233 234 235 236 237 238 239 240 241 242 | |
Concepts
¶
Bases: BaseModel
Represents a collection of key concepts.
Attributes:
| Name | Type | Description |
|---|---|---|
concepts |
List[rConcept]
|
A list of Concept instances, each representing an individual key concept. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
143 144 145 146 147 148 149 150 | |
DataModel
¶
Bases: BaseModel
The main data model that encapsulates the overall analysis.
Attributes:
| Name | Type | Description |
|---|---|---|
main_summary |
str
|
A Detailed overview summarizing the key findings and relations format MD string. |
concept_analysis |
ConceptAnalysis
|
An instance containing the analysis of key concepts. |
topic_insights |
TopicInsights
|
An instance containing insights regarding the topics. |
relevance_assessment |
RelevanceAssessment
|
An instance assessing the relevance and alignment of the query. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
GraphVisualizer
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
visualize(nx_graph, output_file='concept_graph.html', get_output=False)
staticmethod
¶Create interactive visualization using PyVis
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
KnowledgeBase
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 | |
__init__(embedding_dim=256, similarity_threshold=0.61, batch_size=12, n_clusters=4, deduplication_threshold=0.85, model_name=os.getenv('SUMMARYMODEL'), embedding_model=os.getenv('DEFAULTMODELEMBEDDING'), vis_class='FaissVectorStore', vis_kwargs=None, chunk_size=3600, chunk_overlap=130, separator='\n', **kwargs)
¶Initialize the knowledge base with given parameters
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
add_data(texts, metadata=None, direct=False)
async
¶Enhanced version with smart splitting and clustering
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 | |
compute_hash(text)
staticmethod
¶Compute SHA-256 hash of text
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
681 682 683 684 | |
forget_irrelevant(irrelevant_concepts, similarity_threshold=None)
async
¶Remove chunks similar to irrelevant concepts Returns: Number of chunks removed
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | |
graph_enhanced_retrieve(query, k=5, graph_hops=2, relation_weight=0.3, min_similarity=0.2)
async
¶Kombiniert Vector-Search mit Graph-Traversierung
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Suchanfrage |
required |
k
|
int
|
Anzahl initial zu findender Chunks |
5
|
graph_hops
|
int
|
Tiefe der Graph-Traversierung |
2
|
relation_weight
|
float
|
Gewichtung Graph vs Vector (0-1) |
0.3
|
min_similarity
|
float
|
Minimale Ähnlichkeit für Vector-Suche |
0.2
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict mit erweiterten Ergebnissen und Scores |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | |
load(path)
classmethod
¶Load a complete knowledge base from disk, including all sub-components
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path from where to load the knowledge base |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KnowledgeBase |
KnowledgeBase
|
A fully restored knowledge base instance |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 | |
query_concepts(query)
async
¶Query concepts extracted from the knowledge base
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1778 1779 1780 | |
retrieve(query='', query_embedding=None, k=5, min_similarity=0.2, include_connected=True)
async
¶Enhanced retrieval with connected information
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | |
retrieve_with_overview(query, query_embedding=None, k=5, min_similarity=0.2, max_sentences=5, cross_ref_depth=2, max_cross_refs=10, use_graph_expansion=True, graph_hops=2, relation_weight=0.3)
async
¶Enhanced retrieval mit Graph-Awareness und better cross-reference handling
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_graph_expansion
|
bool
|
Nutze Graph-basierte Expansion (empfohlen) |
True
|
graph_hops
|
int
|
Tiefe der Graph-Traversierung |
2
|
relation_weight
|
float
|
Gewichtung Graph vs Vector (0-1) |
0.3
|
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | |
save(path)
¶Save the complete knowledge base to disk, including all sub-components
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path where the knowledge base will be saved |
required |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | |
unified_retrieve(query, k=5, min_similarity=0.2, cross_ref_depth=2, max_cross_refs=10, max_sentences=10, use_graph_expansion=True, graph_hops=2, relation_weight=0.3)
async
¶Unified retrieval mit optionaler Graph-Expansion
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Suchanfrage |
required |
k
|
int
|
Anzahl Primär-Ergebnisse |
5
|
min_similarity
|
float
|
Min. Ähnlichkeit für Vector-Suche |
0.2
|
cross_ref_depth
|
int
|
Tiefe für Cross-References |
2
|
max_cross_refs
|
int
|
Max. Cross-References pro Topic |
10
|
max_sentences
|
int
|
Max. Sentences im Summary |
10
|
use_graph_expansion
|
bool
|
Nutze Graph-Expansion (NEU) |
True
|
graph_hops
|
int
|
Graph-Traversierungs-Tiefe (NEU) |
2
|
relation_weight
|
float
|
Graph vs Vector Gewichtung (NEU) |
0.3
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict mit umfassenden Ergebnissen |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | |
RelevanceAssessment
¶
Bases: BaseModel
Represents an assessment of the relevance of the data in relation to a specific query.
Attributes:
| Name | Type | Description |
|---|---|---|
query_alignment |
float
|
A float representing the alignment between the query and the data. |
confidence_score |
float
|
A float indicating the confidence level in the alignment. |
coverage_analysis |
str
|
A textual description analyzing the data coverage. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
180 181 182 183 184 185 186 187 188 189 190 191 | |
RetrievalResult
dataclass
¶
Structure for organizing retrieval results
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
to_dict()
¶Convert to a JSON-serializable dictionary
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
to_json(indent=2)
¶Convert the result to a JSON string
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
82 83 84 | |
TConcept
¶
Bases: BaseModel
Represents the criteria or target parameters for concept selection and filtering.
Attributes:
| Name | Type | Description |
|---|---|---|
min_importance |
float
|
The minimum importance score a concept must have to be considered. |
target_concepts |
List[str]
|
A list of names of target concepts to focus on. |
relationship_types |
List[str]
|
A list of relationship types to be considered in the analysis. |
categories |
List[str]
|
A list of concept categories to filter or group the concepts. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
TextSplitter
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
approximate(text_len)
¶Approximate the number of chunks and average chunk size for a given text length
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_len
|
int
|
Length of the text to be split |
required |
Returns:
| Type | Description |
|---|---|
float
|
Tuple[int, int]: (number_of_chunks, approximate_chunk_size) |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
split_text(text)
¶Split text into chunks with overlap
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
TopicInsights
¶
Bases: BaseModel
Represents insights related to various topics.
Attributes:
| Name | Type | Description |
|---|---|---|
primary_topics |
list[str]
|
A list of main topics addressed. |
cross_references |
list[str]
|
A list of cross-references that connect different topics. |
knowledge_gaps |
list[str]
|
A list of identified gaps in the current knowledge. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
166 167 168 169 170 171 172 173 174 175 176 177 | |
rConcept
¶
Bases: BaseModel
Represents a key concept with its relationships and associated metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the concept. |
category |
str
|
The category of the concept (e.g., 'technical', 'domain', 'method', etc.). |
relationships |
Dict[str, List[str]]
|
A mapping where each key is a type of relationship and the value is a list of related concept names. |
importance_score |
float
|
A numerical score representing the importance or relevance of the concept. |
context_snippets |
List[str]
|
A list of text snippets providing context where the concept appears. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
normalize_vectors(vectors)
¶
Normalize vectors to unit length
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
93 94 95 96 | |
run_all_tests()
async
¶
Run alle Tests
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 | |
test_edge_cases()
async
¶
Test edge cases und error handling
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 | |
test_graph_enhanced_retrieval()
async
¶
Umfassender Test für Graph-Enhanced Retrieval
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 | |
VectorStores
¶
Vector store implementations for the toolboxv2 system.
taichiNumpyNumbaVectorStores
¶
NumpyVectorStore
¶
Bases: AbstractVectorStore
Source code in toolboxv2/mods/isaa/base/VectorStores/taichiNumpyNumbaVectorStores.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
types
¶
AbstractVectorStore
¶
Bases: ABC
Abstract base class for vector stores
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
add_embeddings(embeddings, chunks)
abstractmethod
¶Add embeddings and their corresponding chunks to the store
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
21 22 23 24 | |
clear()
abstractmethod
¶Clear all data from the store
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
41 42 43 44 | |
load(data)
abstractmethod
¶Load the vector store from disk
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
36 37 38 39 | |
rebuild_index()
abstractmethod
¶Optional for faster searches
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
46 47 48 49 | |
save()
abstractmethod
¶Save the vector store to disk
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
31 32 33 34 | |
search(query_embedding, k=5, min_similarity=0.7)
abstractmethod
¶Search for similar vectors
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
26 27 28 29 | |
Chunk
dataclass
¶Represents a chunk of text with its embedding and metadata
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
8 9 10 11 12 13 14 15 | |
audio_io
¶
OmniCore Audio Module¶
Unified Speech-to-Text (STT) and Text-to-Speech (TTS) interface with multiple backend support for local and cloud processing.
Quick Start:¶
from omnicore_audio import transcribe, synthesize
# Transcribe audio
result = transcribe("recording.wav")
print(result.text)
# Synthesize speech
audio = synthesize("Hello, world!")
audio.save("output.wav")
Backends:¶
STT: - faster_whisper: Local CPU/GPU (default) - groq_whisper: Groq Cloud API
TTS
- piper: Local CPU (default)
- vibevoice: Local GPU (requires NVIDIA)
- groq_tts: Groq Cloud API
- elevenlabs: ElevenLabs API
Configuration:¶
# STT with specific backend
from omnicore_audio import transcribe, STTConfig, STTBackend
result = transcribe(
"audio.wav",
config=STTConfig(
backend=STTBackend.GROQ_WHISPER,
language="de"
)
)
# TTS with specific backend
from omnicore_audio import synthesize, TTSConfig, TTSBackend
audio = synthesize(
"Text to speak",
config=TTSConfig(
backend=TTSBackend.ELEVENLABS,
voice="Rachel"
)
)
Author: OmniCore Team Version: 1.0.0 License: MIT
check_requirements(backend)
¶
Check if requirements for a backend are satisfied.
Source code in toolboxv2/mods/isaa/base/audio_io/__init__.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
list_backends()
¶
List all available backends with their requirements.
Source code in toolboxv2/mods/isaa/base/audio_io/__init__.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
Stt
¶
OmniCore STT Module - Speech-to-Text with Multiple Backends¶
Supported Backends: - faster_whisper: Local CPU/GPU inference (recommended for privacy) - groq_whisper: Groq Cloud API (fast, reliable)
All functions are "dumb" - they receive all config directly and return text. No state, no side effects, pure transformations.
Author: OmniCore Team Version: 1.0.0
STTBackend
¶
Bases: Enum
Available STT backends.
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
30 31 32 33 34 | |
STTConfig
dataclass
¶Configuration for STT operations.
Attributes:
| Name | Type | Description |
|---|---|---|
backend |
STTBackend
|
Which STT engine to use |
model |
str
|
Model identifier (backend-specific) |
language |
Optional[str]
|
ISO 639-1 language code (e.g., "en", "de") |
temperature |
float
|
Sampling temperature (0.0 = deterministic) |
prompt |
Optional[str]
|
Context hint for better recognition |
word_timestamps |
bool
|
Include word-level timestamps |
Backend-specific defaults
faster_whisper: model="small" (good CPU balance) groq_whisper: model="whisper-large-v3-turbo" (fastest)
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
STTResult
dataclass
¶Result from STT transcription.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
Transcribed text |
language |
Optional[str]
|
Detected language code |
duration |
Optional[float]
|
Audio duration in seconds |
segments |
list
|
List of text segments with timestamps |
confidence |
Optional[float]
|
Average confidence score (if available) |
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
STTSegment
dataclass
¶A segment of transcribed text with timing.
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
99 100 101 102 103 104 105 106 | |
transcribe(audio, config=None, **kwargs)
¶Transcribe audio to text.
This is the main entry point for STT operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio
|
AudioData
|
Audio data (bytes, file path, or file-like object) |
required |
config
|
Optional[STTConfig]
|
STTConfig object with all settings |
None
|
**kwargs
|
Override config settings |
{}
|
Returns:
| Type | Description |
|---|---|
STTResult
|
STTResult with transcribed text and metadata |
Examples:
Simple usage with defaults (local faster-whisper)¶
result = transcribe("audio.wav") print(result.text)
Using Groq API¶
result = transcribe( audio_bytes, config=STTConfig( backend=STTBackend.GROQ_WHISPER, groq_api_key="your-key" ) )
German audio with context hint¶
result = transcribe( "interview.mp3", config=STTConfig( language="de", prompt="Interview über KI und Technologie" ) )
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
transcribe_groq(audio, api_key=None, model='whisper-large-v3-turbo', language=None, **kwargs)
¶Transcribe using Groq Whisper API.
Convenience function for quick API transcription.
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
transcribe_local(audio, model='small', language=None, **kwargs)
¶Transcribe using local faster-whisper.
Convenience function for quick local transcription.
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
transcribe_stream(audio_chunks, config=None, **kwargs)
¶Stream transcription from audio chunks.
Note: Not all backends support true streaming. For non-streaming backends, chunks are batched internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_chunks
|
Generator[bytes, None, None]
|
Generator yielding audio bytes |
required |
config
|
Optional[STTConfig]
|
STTConfig object |
None
|
**kwargs
|
Override config settings |
{}
|
Yields:
| Type | Description |
|---|---|
STTSegment
|
STTSegment objects as transcription progresses |
Example
def mic_stream(): # Your microphone capture logic while recording: yield audio_chunk
for segment in transcribe_stream(mic_stream()): print(f"[{segment.start:.1f}s] {segment.text}")
Source code in toolboxv2/mods/isaa/base/audio_io/Stt.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
Tts
¶
OmniCore TTS Module - Text-to-Speech with Multiple Backends¶
Supported Backends: - piper: Local CPU inference (fast, lightweight) - vibevoice: Local GPU inference (high quality, requires GPU) - groq_tts: Groq Cloud API (Orpheus model, fast) - elevenlabs: ElevenLabs API (highest quality)
All functions are "dumb" - they receive all config directly and return audio. No state, no side effects, pure transformations.
Version: 1.0.0
TTSBackend
¶
Bases: Enum
Available TTS backends.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
32 33 34 35 36 37 38 | |
TTSConfig
dataclass
¶Configuration for TTS operations.
Attributes:
| Name | Type | Description |
|---|---|---|
backend |
TTSBackend
|
Which TTS engine to use |
voice |
str
|
Voice identifier (backend-specific) |
language |
str
|
ISO 639-1 language code |
speed |
float
|
Speech speed multiplier (0.5 - 2.0) |
quality |
TTSQuality
|
Quality preset affecting output |
sample_rate |
int
|
Output sample rate in Hz |
output_format |
str
|
Audio format ("wav", "mp3", "opus") |
Backend-specific
piper: model_path for custom models vibevoice: speaker_id for multi-speaker groq_tts: voice from Orpheus voices elevenlabs: voice_id, model_id, stability, similarity_boost
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
TTSQuality
¶
Bases: Enum
Audio quality presets.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
41 42 43 44 45 46 | |
TTSResult
dataclass
¶Result from TTS synthesis.
Attributes:
| Name | Type | Description |
|---|---|---|
audio |
bytes
|
Raw audio bytes |
format |
str
|
Audio format (wav, mp3, etc.) |
sample_rate |
int
|
Audio sample rate in Hz |
duration |
Optional[float]
|
Audio duration in seconds |
channels |
int
|
Number of audio channels |
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
save(path)
¶Save audio to file.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
131 132 133 | |
to_numpy()
¶Convert to numpy array (requires numpy).
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
135 136 137 138 139 140 141 142 143 144 145 | |
synthesize(text, config=None, **kwargs)
¶Synthesize speech from text.
This is the main entry point for TTS operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to convert to speech |
required |
config
|
Optional[TTSConfig]
|
TTSConfig object with all settings |
None
|
**kwargs
|
Override config settings |
{}
|
Returns:
| Type | Description |
|---|---|
TTSResult
|
TTSResult with audio data and metadata |
Examples:
Simple usage with defaults (local Piper)¶
result = synthesize("Hello, world!") result.save("output.wav")
Using ElevenLabs API¶
result = synthesize( "Professional narration text.", config=TTSConfig( backend=TTSBackend.ELEVENLABS, elevenlabs_api_key="your-key", voice="21m00Tcm4TlvDq8ikWAM" ) )
German with Piper¶
result = synthesize( "Guten Tag, wie geht es Ihnen?", config=TTSConfig( voice="de_DE-thorsten-medium", language="de" ) )
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
synthesize_elevenlabs(text, api_key=None, voice='21m00Tcm4TlvDq8ikWAM', **kwargs)
¶Synthesize using ElevenLabs API.
Convenience function for premium quality synthesis.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
synthesize_groq(text, api_key=None, voice='Fritz-PlayAI', **kwargs)
¶Synthesize using Groq TTS API.
Convenience function for quick API synthesis.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
synthesize_piper(text, voice='en_US-amy-medium', **kwargs)
¶Synthesize using local Piper TTS.
Convenience function for quick local synthesis.
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
658 659 660 661 662 663 664 665 666 | |
synthesize_stream(text, config=None, **kwargs)
¶Stream audio synthesis from text.
Yields audio chunks as they become available. Useful for real-time playback or progressive download.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to convert to speech |
required |
config
|
Optional[TTSConfig]
|
TTSConfig object |
None
|
**kwargs
|
Override config settings |
{}
|
Yields:
| Type | Description |
|---|---|
bytes
|
Audio bytes chunks |
Example
for chunk in synthesize_stream("Long text to speak..."): audio_player.write(chunk)
Source code in toolboxv2/mods/isaa/base/audio_io/Tts.py
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | |
audioIo
¶
OmniCore Audio I/O Integration¶
High-level audio processing functions for the OmniCore Agent. Provides two main entry points: - process_audio_raw(): Complete audio file processing - process_audio_stream(): Real-time audio stream processing
Supports multiple processing pipelines: 1. Pipeline Mode: STT → Agent → TTS (separate components) 2. Native Mode: End-to-end audio LLM (e.g., LFM2.5-Audio)
Author: OmniCore Team Version: 1.0.0
AudioIOConfig
dataclass
¶Configuration for Audio I/O processing.
Attributes:
| Name | Type | Description |
|---|---|---|
mode |
ProcessingMode
|
Processing mode (pipeline or native) |
quality |
AudioQuality
|
Output quality preset |
language |
str
|
Primary language (ISO 639-1) |
Pipeline mode settings
stt_config: Configuration for speech-to-text tts_config: Configuration for text-to-speech
Native mode settings
native_model: Model identifier for native audio LLM native_backend: Backend for native model (transformers, llama_cpp)
Common settings
sample_rate: Audio sample rate (default: 16000) channels: Audio channels (default: 1 mono) enable_vad: Voice Activity Detection
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
AudioIOResult
dataclass
¶Result from audio processing.
Attributes:
| Name | Type | Description |
|---|---|---|
text_input |
str
|
Transcribed user input |
text_output |
str
|
Generated response text |
audio_output |
Optional[bytes]
|
Synthesized audio bytes |
tool_calls |
list
|
List of tool calls made during processing |
metadata |
dict
|
Additional processing metadata |
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
duration
property
¶Estimated audio duration in seconds.
AudioQuality
¶
Bases: Enum
Output audio quality preset.
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
65 66 67 68 69 70 | |
ProcessingMode
¶
Bases: Enum
Audio processing mode.
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
58 59 60 61 62 | |
process_audio_native(audio, processor=None, model='LiquidAI/LFM2.5-Audio-1.5B', device='cpu', tools=None, tool_executor=None, **kwargs)
¶Process audio using native end-to-end audio model.
Convenience function for native audio model mode.
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |
process_audio_pipeline(audio, processor, stt_backend=STTBackend.FASTER_WHISPER, tts_backend=TTSBackend.PIPER, language='en', **kwargs)
¶Process audio using STT → Processor → TTS pipeline.
Convenience function for pipeline mode.
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | |
process_audio_raw(audio, processor, config=None, **kwargs)
async
¶Process a complete audio file/buffer through the agent.
This function handles the full pipeline: 1. Audio input (file, bytes, or path) 2. Understanding (STT or native audio model) 3. Processing (your agent logic via processor callback) 4. Response generation (TTS or native audio model)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio
|
AudioData
|
Audio input (bytes, file path, or Path object) |
required |
processor
|
AsyncTextProcessor
|
Function that takes user text and returns response text Signature: (str) -> str |
required |
config
|
Optional[AudioIOConfig]
|
AudioIOConfig with all settings |
None
|
**kwargs
|
Override config settings |
{}
|
Returns:
| Type | Description |
|---|---|
AudioIOResult
|
AudioIOResult with text and audio outputs |
Examples:
Simple usage with pipeline mode¶
def my_agent(text: str) -> str: if "time" in text.lower(): return f"The time is {get_current_time()}" return "I don't understand"
result = process_audio_raw( "question.wav", processor=my_agent ) result.audio_output # WAV bytes of response
Using native audio model (LFM2.5-Audio)¶
result = process_audio_raw( audio_bytes, processor=my_agent, config=AudioIOConfig( mode=ProcessingMode.NATIVE_AUDIO, native_model="LiquidAI/LFM2.5-Audio-1.5B", native_device="cpu" ) )
With tool calling¶
tools = [{ "name": "get_time", "description": "Get current time", "parameters": {} }]
def execute_tool(name: str, args: dict) -> str: if name == "get_time": from datetime import datetime return datetime.now().strftime("%H:%M") return "Unknown tool"
result = process_audio_raw( "user_question.wav", processor=my_agent, config=AudioIOConfig( mode=ProcessingMode.NATIVE_AUDIO, tools=tools, tool_executor=execute_tool ) )
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
process_audio_stream(audio_chunks, processor, config=None, **kwargs)
async
¶Process a stream of audio chunks through the agent.
Use this for real-time audio processing where you want to yield audio output as soon as possible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_chunks
|
Generator[bytes, None, None]
|
Generator yielding audio byte chunks |
required |
processor
|
AsyncTextProcessor
|
Function that processes transcribed text |
required |
config
|
Optional[AudioIOConfig]
|
AudioIOConfig with all settings |
None
|
**kwargs
|
Override config settings |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncGenerator[bytes, None]
|
Audio bytes chunks for immediate playback |
Examples:
Real-time processing with microphone¶
def mic_stream(): import pyaudio p = pyaudio.PyAudio() stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024) while recording: yield stream.read(1024)
for audio_chunk in process_audio_stream( mic_stream(), processor=my_agent ): speaker.write(audio_chunk)
Source code in toolboxv2/mods/isaa/base/audio_io/audioIo.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
native
¶
LiquidAI
¶OmniCore Native Audio Model Runner¶
Standalone runner for native audio language models like LFM2.5-Audio. Designed for local CPU execution on systems without GPU.
Supported Models: - LiquidAI/LFM2.5-Audio-1.5B (recommended for CPU) - LiquidAI/LFM2-Audio-1.5B
Features: - CPU-optimized inference (llama.cpp GGUF support) - Interleaved generation (audio + text simultaneously) - Sequential generation (ASR or TTS mode) - Tool calling support - Real-time streaming output
Hardware Requirements (LFM2.5-Audio-1.5B): - CPU: Any modern x86_64 or ARM64 - RAM: 4-8GB (Q4 quantized) - Disk: ~3GB for model files
Author: OmniCore Team Version: 1.0.0
GenerationMode
¶
Bases: Enum
Native audio model generation modes.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
53 54 55 56 57 | |
LFMAudioLlamaCpp
¶
Bases: NativeAudioModel
LFM2.5-Audio model using llama.cpp (GGUF).
CPU-optimized for maximum performance on x86_64/ARM64.
Requires: pip install llama-cpp-python huggingface_hub
Note: Audio model support in llama.cpp may be limited. Check https://github.com/ggml-org/llama.cpp for latest updates.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
generate(audio_input=None, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
¶Generate response.
Note: llama.cpp audio support is experimental. This implementation uses text-only mode as fallback.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
generate_stream(audio_input=None, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
¶Stream generation (text only for llama.cpp).
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
synthesize(text)
¶TTS mode - not fully supported in llama.cpp.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
587 588 589 590 591 592 | |
transcribe(audio)
¶ASR mode - not fully supported in llama.cpp.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
580 581 582 583 584 585 | |
LFMAudioTransformers
¶
Bases: NativeAudioModel
LFM2.5-Audio model using HuggingFace transformers.
Requires: pip install liquid-audio torch torchaudio
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
generate(audio_input=None, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
¶Generate response.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
generate_stream(audio_input=None, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
¶Stream generation.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
synthesize(text)
¶TTS: text → audio.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
389 390 391 392 393 394 395 396 397 398 | |
transcribe(audio)
¶ASR: audio → text.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
378 379 380 381 382 383 384 385 386 387 | |
NativeAudioConfig
dataclass
¶Configuration for native audio model execution.
Attributes:
| Name | Type | Description |
|---|---|---|
model_id |
str
|
HuggingFace model ID or local path |
backend |
NativeModelBackend
|
Which inference backend to use |
device |
str
|
Device for inference (cpu, cuda) |
quantization |
Optional[str]
|
Quantization level for GGUF (Q4_K_M, Q8_0, etc.) |
Generation settings
generation_mode: Interleaved or sequential max_tokens: Maximum tokens to generate temperature: Sampling temperature for audio audio_top_k: Top-k sampling for audio tokens
System settings
system_prompt: Default system prompt num_threads: CPU threads for llama.cpp cache_dir: Directory for model cache
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
NativeAudioModel
¶
Bases: ABC
Abstract base class for native audio models.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
generate(audio_input, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
abstractmethod
¶Generate response from audio/text input.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
133 134 135 136 137 138 139 140 141 142 | |
generate_stream(audio_input, text_input=None, mode=GenerationMode.INTERLEAVED, **kwargs)
abstractmethod
¶Stream generation, yielding (text_chunk, audio_chunk) tuples.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
144 145 146 147 148 149 150 151 152 153 | |
synthesize(text)
abstractmethod
¶TTS mode: text → audio.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
160 161 162 163 | |
transcribe(audio)
abstractmethod
¶ASR mode: audio → text.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
155 156 157 158 | |
NativeAudioOutput
dataclass
¶Output from native audio model generation.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
115 116 117 118 119 120 121 122 | |
NativeModelBackend
¶
Bases: Enum
Backend for running native audio models.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
60 61 62 63 64 | |
demo_conversation()
¶Demo: Interactive voice conversation.
Requires microphone and speakers.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
demo_tool_calling()
¶Demo: Tool calling with LFM2.5-Audio.
Shows how the model can generate tool calls and incorporate results.
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | |
load_native_audio_model(config)
¶Load native audio model with specified backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
NativeAudioConfig
|
NativeAudioConfig with model settings |
required |
Returns:
| Type | Description |
|---|---|
NativeAudioModel
|
NativeAudioModel instance |
Example
config = NativeAudioConfig( model_id="LiquidAI/LFM2.5-Audio-1.5B", backend=NativeModelBackend.TRANSFORMERS, device="cpu" ) model = load_native_audio_model(config)
result = model.generate( audio_input=audio_bytes, mode=GenerationMode.INTERLEAVED ) print(result.text)
Source code in toolboxv2/mods/isaa/base/audio_io/native/LiquidAI.py
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | |
bench
¶
benchmark
¶
══════════════════════════════════════════════════════════════════════════════ BENCHMARK.PY - Minimal Token, Maximum Insight Model Evaluation ══════════════════════════════════════════════════════════════════════════════
Design: 1. ISOLATION: Each probe = separate API call (model can't adapt) 2. EFFICIENCY: Dynamic generation, minimal tokens per insight 3. DETERMINISTIC: Same seed = same tests = comparable results 4. FLEXIBLE: Quick (1 call) to Precision (25+ calls)
Usage
bench = Benchmark() report = await bench.run(model_fn, mode='standard') print(report)
AgentAdapter
¶Adapter for FlowAgent integration with cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 | |
AgentAdapterSt
¶Adapter for FlowAgent integration with cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 | |
Benchmark
¶Main runner - modes: quick(1), standard(4), full(15), precision(20×3)
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 | |
FlagInfo
dataclass
¶Complete information about a flag
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
44 45 46 47 48 49 50 51 52 | |
Generator
¶Dynamic probe generation with randomization for anti-memorization
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 | |
MAKERAdapter
¶Adapter for FlowAgent integration with cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 | |
MAKERAdapterV2
¶Adapter for FlowAgent integration with cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 | |
Report
dataclass
¶Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
to_dict()
¶Enhanced dict export with probe I/O details
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
RowModelAdapter
¶Adapter for direct LiteLLM model testing with cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 | |
Scorer
¶Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 | |
SimpleModelAdapter
¶Simple adapter for any async model function with optional cost tracking
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2910 2911 2912 2913 2914 2915 2916 2917 2918 | |
demo(p)
¶Demo model for testing - simulates a 'good' model
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 | |
demo_bad(p)
¶Demo 'bad' model - triggers many flags
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | |
demo_bad_v2(prompt)
¶Deterministisches 'schlechtes' Modell - triggert Flags
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 | |
demo_good_v2(prompt)
¶Deterministisches 'gutes' Modell - matched auf Probe-Typ
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 | |
get_flag_info(flag)
¶Get detailed info for a flag
Source code in toolboxv2/mods/isaa/base/bench/benchmark.py
184 185 186 187 188 189 | |
dashboard
¶
══════════════════════════════════════════════════════════════════════════════ DASHBOARD.PY - Benchmark Comparison Dashboard Generator ══════════════════════════════════════════════════════════════════════════════
Generates interactive HTML dashboard from multiple benchmark reports. Features: Leaderboard, dimension filters, persona radar, flag analysis.
Usage
from dashboard import Dashboard
reports = [report1, report2, report3] # From Benchmark().run() html = Dashboard.generate(reports) Dashboard.save(reports, "comparison.html")
Dashboard
¶Generates comparison dashboard HTML from benchmark reports
Source code in toolboxv2/mods/isaa/base/bench/dashboard.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 | |
from_json_files(filepaths, output='dashboard.html')
staticmethod
¶Load reports from JSON files and generate dashboard
Source code in toolboxv2/mods/isaa/base/bench/dashboard.py
1544 1545 1546 1547 1548 1549 1550 1551 | |
generate(reports, title='Benchmark Comparison')
staticmethod
¶Generate complete HTML dashboard from reports list
Source code in toolboxv2/mods/isaa/base/bench/dashboard.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | |
save(reports, filepath='dashboard.html', title='Benchmark Comparison')
staticmethod
¶Generate and save dashboard to file
Source code in toolboxv2/mods/isaa/base/bench/dashboard.py
1536 1537 1538 1539 1540 1541 1542 | |
rl
¶
ToolBoxV2 RL Training Pipeline for FlowAgent
Complete lifecycle for training local LLMs via GRPO/KTO with LoRA, converting to GGUF, and deploying via Ollama.
Modules: - hardware_config: Hardware detection and optimization profiles - data_collection: Trace collection from FlowAgent checkpoints - reward_functions: Verifiable rewards for code/tool execution - dataset_builder: KTO/GRPO dataset preparation - training: LoRA-based GRPO/KTO training - export: GGUF conversion and Ollama deployment
Quick Start
from toolboxv2.mods.isaa.base.rl import TrainingPipeline
pipeline = TrainingPipeline( agent_name="isaa", base_model="Qwen/Qwen2.5-1.5B-Instruct", method="grpo" ) results = pipeline.run_full_pipeline(deploy_ollama=True)
BaseReward
¶
Bases: ABC
Abstract base class for reward functions
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
compute(trace)
abstractmethod
¶Compute reward for an execution trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace
|
ExecutionTrace object with full execution details |
required |
Returns:
| Type | Description |
|---|---|
RewardResult
|
RewardResult with score and details |
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
CheckpointLoader
¶
Loads and extracts training data from FlowAgent checkpoints.
Handles overlapping data from multiple checkpoints and deduplicates based on trace IDs.
Checkpoint Structure (AgentCheckpoint): - session_data: dict[session_id, {history: [{role, content}, ...], session_type}] - variable_scopes: dict[scope_name, {var_name: value}] - task_state: dict[task_id, task_dict] - conversation_history: list[{role, content}] - agent_state: dict with is_running, is_paused, tokens, costs - tool_capabilities: dict[tool_name, capability_info]
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
__init__(agent_name=None, checkpoint_path=None)
¶Initialize checkpoint loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
Optional[str]
|
Name of the FlowAgent (optional if using discover_all_agents) |
None
|
checkpoint_path
|
Optional[str]
|
Path to checkpoint directory or base checkpoint folder |
None
|
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
discover_all_agents()
¶Discover all agent names that have checkpoints.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of agent names with available checkpoints |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
extract_traces_from_checkpoint(checkpoint, agent_name=None)
¶Extract execution traces from a checkpoint.
Looks into: - session_data for conversation history (primary source) - variable_scopes for context and delegation info - task_state for task execution details - agent_state for token/cost metrics - tool_capabilities for available tools
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint object |
required | |
agent_name
|
str
|
Optional agent name for metadata |
None
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
generate_synthetic_tasks(num_tasks=100)
¶Generate synthetic training tasks from checkpoint data.
Analyzes patterns in successful executions to create similar training prompts.
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
get_training_statistics()
¶Get comprehensive statistics about available training data.
Returns:
| Type | Description |
|---|---|
dict
|
Dict with statistics about traces, sessions, tools, etc. |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | |
list_checkpoints()
¶List available checkpoints with metadata
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
load_all_agents_traces(deduplicate=True)
¶Load traces from all agents' checkpoints.
Returns:
| Type | Description |
|---|---|
dict[str, list[ExecutionTrace]]
|
Dict mapping agent_name -> list of ExecutionTrace |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
load_all_traces(deduplicate=True, max_age_hours=None)
¶Load traces from all checkpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deduplicate
|
bool
|
Remove duplicate traces based on trace_id |
True
|
max_age_hours
|
int
|
Only load checkpoints newer than this (None = all) |
None
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of unique ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
load_checkpoint(filepath)
¶Load a single checkpoint file
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
432 433 434 435 | |
CodeExecutionReward
¶
Bases: BaseReward
Reward for successful code execution.
Actually runs the code and checks if it executes without errors. This is a verifiable binary reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
__init__(timeout=30, sandbox=True)
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int
|
Max execution time in seconds |
30
|
sandbox
|
bool
|
Use restricted execution environment |
True
|
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
69 70 71 72 73 74 75 76 | |
compute(trace)
¶Check if code in the response executes successfully
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
DatasetPipeline
¶
Complete pipeline for building training datasets from FlowAgent.
Combines trace collection, reward computation, and dataset building.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
build_grpo_dataset(output_path, **kwargs)
¶Build and save GRPO dataset
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
635 636 637 638 639 640 641 642 643 644 | |
build_kto_dataset(output_path, **kwargs)
¶Build and save KTO dataset
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
624 625 626 627 628 629 630 631 632 633 | |
collect_all_traces()
¶Collect traces from all sources
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
get_pipeline_statistics()
¶Get comprehensive pipeline statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
654 655 656 657 658 659 660 661 662 663 664 665 | |
get_unlabeled_for_review(limit=50)
¶Get traces that need manual review
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
646 647 648 | |
label_trace(trace_id, label, notes='')
¶Apply manual label
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
650 651 652 | |
EfficiencyReward
¶
Bases: BaseReward
Soft reward for efficiency.
Rewards concise, efficient responses that don't waste tokens or make unnecessary tool calls.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
compute(trace)
¶Compute efficiency score
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
ExecutionTrace
dataclass
¶
Complete execution trace for a single agent run
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
from_dict(data)
classmethod
¶Reconstruct from dict
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
to_dict()
¶Convert to serializable dict
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
89 90 91 92 93 94 95 96 97 | |
ExportPipeline
¶
Complete export pipeline from trained model to deployed Ollama.
Source code in toolboxv2/mods/isaa/base/rl/export.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
run(quantization='Q4_K_M', system_prompt='', hosting_profile='auto')
¶Run complete export pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantization
|
str
|
GGUF quantization type |
'Q4_K_M'
|
system_prompt
|
str
|
System prompt for Ollama model |
''
|
hosting_profile
|
str
|
"ryzen" or "auto" |
'auto'
|
Returns:
| Type | Description |
|---|---|
dict
|
Pipeline results |
Source code in toolboxv2/mods/isaa/base/rl/export.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
FormatComplianceReward
¶
Bases: BaseReward
Reward for following output format requirements.
Checks if the response follows expected formatting patterns (NO XML - plain text focus).
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
compute(trace)
¶Check format compliance
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
GGUFExporter
¶
Export HuggingFace models to GGUF format for llama.cpp/Ollama.
Requires llama.cpp to be installed or will clone it automatically.
Source code in toolboxv2/mods/isaa/base/rl/export.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
__init__(model_path, llama_cpp_path=None, output_dir=None)
¶Initialize exporter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to HuggingFace model directory |
required |
llama_cpp_path
|
Optional[str]
|
Path to llama.cpp installation |
None
|
output_dir
|
Optional[str]
|
Output directory for GGUF files |
None
|
Source code in toolboxv2/mods/isaa/base/rl/export.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
convert(quantization='Q4_K_M', output_name=None)
¶Convert HuggingFace model to GGUF.
The conversion is a two-step process: 1. Convert HF model to F16 GGUF using convert_hf_to_gguf.py 2. Quantize to target format using llama-quantize (if not F16/F32)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantization
|
str
|
Quantization type (Q4_K_M, Q8_0, F16, etc.) |
'Q4_K_M'
|
output_name
|
Optional[str]
|
Output filename (default: model-{quantization}.gguf) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to GGUF file |
Source code in toolboxv2/mods/isaa/base/rl/export.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
get_recommended_quantization(available_ram_gb=8.0)
¶Get recommended quantization based on available RAM
Source code in toolboxv2/mods/isaa/base/rl/export.py
272 273 274 275 276 277 278 279 280 281 282 283 | |
GGUFQuantization
dataclass
¶
GGUF quantization options
Source code in toolboxv2/mods/isaa/base/rl/export.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
GRPODatasetBuilder
¶
Builds GRPO (Group Relative Policy Optimization) datasets.
GRPO requires multiple completions per prompt with rewards, enabling contrastive learning within groups.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
__init__(reward_engine=None, num_completions=4, system_prompt='')
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reward_engine
|
Optional[RewardEngine]
|
For computing rewards |
None
|
num_completions
|
int
|
Target completions per prompt |
4
|
system_prompt
|
str
|
System prompt for all examples |
''
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
build_dataset(traces, min_group_size=2, max_examples=None, include_singles=True)
¶Build GRPO dataset from traces.
Groups traces by query and creates examples with multiple completions per prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
required |
min_group_size
|
int
|
Minimum traces per group for contrastive learning |
2
|
max_examples
|
int
|
Maximum total examples |
None
|
include_singles
|
bool
|
Include single traces with synthetic variations |
True
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
build_example_from_group(prompt, traces)
¶Build GRPO example from a group of traces with same prompt
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
build_synthetic_groups(traces, agent_generate_func, num_generations=4)
¶Build GRPO dataset by generating multiple completions per prompt.
Uses the agent to generate additional completions for each unique query, enabling GRPO even with single-trace data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
Existing traces (one per query) |
required |
agent_generate_func
|
Callable
|
async func(prompt) -> str |
required |
num_generations
|
int
|
Completions per prompt |
4
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
get_statistics(examples)
¶Get dataset statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
group_traces_by_query(traces)
¶Group traces by similar queries
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
load_dataset(input_path)
¶Load GRPO dataset from file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
save_dataset(examples, output_path, format='jsonl')
¶Save GRPO dataset to file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
to_hf_dataset(examples)
¶Convert to HuggingFace Dataset format for TRL GRPOTrainer
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
GRPOExample
dataclass
¶
Single example for GRPO training with multiple completions
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
33 34 35 36 37 38 39 40 41 42 43 44 45 | |
HardwareConfig
dataclass
¶
Hardware configuration for training optimization
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
get_torch_dtype()
¶Return the appropriate torch dtype
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
129 130 131 132 133 134 135 | |
get_training_device()
¶Return the device string for training
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
123 124 125 126 127 | |
summary()
¶Human-readable summary
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
to_grpo_config()
¶Convert to GRPO-specific config
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
160 161 162 163 164 165 166 | |
to_lora_config()
¶Convert to LoRA config dict
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
149 150 151 152 153 154 155 156 157 158 | |
to_training_args()
¶Convert to training arguments dict
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
137 138 139 140 141 142 143 144 145 146 147 | |
KTODatasetBuilder
¶
Builds KTO (Kahneman-Tversky Optimization) datasets from traces.
KTO uses binary feedback (good/bad) rather than preference pairs. Better suited for FlowAgent where we have verifiable outcomes.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
__init__(reward_engine=None, reward_threshold=0.6, system_prompt='')
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reward_engine
|
Optional[RewardEngine]
|
For computing rewards (uses default if None) |
None
|
reward_threshold
|
float
|
Score threshold for positive label |
0.6
|
system_prompt
|
str
|
System prompt to prepend to all prompts |
''
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
build_dataset(traces, balance=True, max_examples=None)
¶Build KTO dataset from traces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
required |
balance
|
bool
|
Balance positive/negative examples |
True
|
max_examples
|
int
|
Maximum total examples |
None
|
Returns:
| Type | Description |
|---|---|
list[KTOExample]
|
List of KTOExample objects |
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
build_from_checkpoints(loader, **kwargs)
¶Build dataset from checkpoints
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
146 147 148 149 150 151 152 153 | |
build_from_collector(collector, include_unlabeled=True, **kwargs)
¶Build dataset from TraceCollector
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
136 137 138 139 140 141 142 143 144 | |
get_statistics(examples)
¶Get dataset statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
load_dataset(input_path)
¶Load dataset from file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
save_dataset(examples, output_path, format='jsonl')
¶Save dataset to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
examples
|
list[KTOExample]
|
KTO examples |
required |
output_path
|
str
|
Output file path |
required |
format
|
str
|
"jsonl" or "json" |
'jsonl'
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
to_hf_dataset(examples)
¶Convert to HuggingFace Dataset format
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
trace_to_example(trace)
¶Convert single trace to KTO example
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
KTOExample
dataclass
¶
Single example for KTO training
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
18 19 20 21 22 23 24 25 26 27 28 29 30 | |
LearnedReward
¶
Bases: BaseReward
Learned reward from manual labels.
Uses a simple pattern matching model trained on manually labeled examples to predict reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
compute(trace)
¶Compute reward using learned patterns
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | |
learn_from_traces(traces, min_examples=10)
¶Learn patterns from labeled traces.
Simple approach: extract n-grams and tool patterns from positive and negative examples.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
save_patterns()
¶Save learned patterns
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
535 536 537 538 539 540 | |
OllamaDeployer
¶
Deploy GGUF models to Ollama with optimized hosting profiles.
Source code in toolboxv2/mods/isaa/base/rl/export.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
__init__(ollama_path='ollama')
¶Initialize deployer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ollama_path
|
str
|
Path to ollama executable |
'ollama'
|
Source code in toolboxv2/mods/isaa/base/rl/export.py
318 319 320 321 322 323 324 325 326 | |
create_model(model_name, gguf_path, system_prompt='', temperature=0.7, num_ctx=4096)
¶Create Ollama model from GGUF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the Ollama model |
required |
gguf_path
|
str
|
Path to GGUF file |
required |
system_prompt
|
str
|
System prompt |
''
|
temperature
|
float
|
Default temperature |
0.7
|
num_ctx
|
int
|
Context window |
4096
|
Returns:
| Type | Description |
|---|---|
str
|
Model name |
Source code in toolboxv2/mods/isaa/base/rl/export.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
create_modelfile(gguf_path, system_prompt='', temperature=0.7, num_ctx=4096, stop_tokens=None)
¶Create Ollama Modelfile content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gguf_path
|
str
|
Path to GGUF file |
required |
system_prompt
|
str
|
System prompt for the model |
''
|
temperature
|
float
|
Default temperature |
0.7
|
num_ctx
|
int
|
Context window size |
4096
|
stop_tokens
|
list[str]
|
Stop sequences |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Modelfile content as string |
Source code in toolboxv2/mods/isaa/base/rl/export.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
delete_model(model_name)
¶Delete an Ollama model
Source code in toolboxv2/mods/isaa/base/rl/export.py
476 477 478 479 480 481 482 483 484 485 | |
get_auto_profile()
¶Auto-detect optimal hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
get_ryzen_profile(cpu_cores=16)
¶Get Ryzen-optimized hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
502 503 504 505 506 507 508 509 510 | |
list_models()
¶List installed Ollama models
Source code in toolboxv2/mods/isaa/base/rl/export.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
run_model(model_name, prompt)
¶Run a prompt through the model
Source code in toolboxv2/mods/isaa/base/rl/export.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
start_server_with_profile(profile)
¶Start Ollama server with hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
OllamaHostingProfile
dataclass
¶
Hosting profile for Ollama
Source code in toolboxv2/mods/isaa/base/rl/export.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
to_env()
¶Convert to environment variables
Source code in toolboxv2/mods/isaa/base/rl/export.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
RLTrainer
¶
Main trainer class for GRPO/KTO training with LoRA.
Handles the complete training lifecycle: 1. Load base model 2. Apply LoRA adapters 3. Train with GRPO or KTO 4. Save merged model
Source code in toolboxv2/mods/isaa/base/rl/training.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
__init__(config)
¶Initialize trainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TrainingConfig
|
TrainingConfig with all settings |
required |
Source code in toolboxv2/mods/isaa/base/rl/training.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
evaluate(eval_dataset, metrics=None)
¶Evaluate model on dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eval_dataset
|
Evaluation dataset |
required | |
metrics
|
list[str]
|
List of metrics to compute |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of evaluation results |
Source code in toolboxv2/mods/isaa/base/rl/training.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
get_training_summary()
¶Get human-readable training summary
Source code in toolboxv2/mods/isaa/base/rl/training.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
save_model(output_path=None, merge_lora=True)
¶Save trained model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Optional[str]
|
Output directory (default: config.output_dir/final) |
None
|
merge_lora
|
bool
|
Merge LoRA weights into base model |
True
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
setup()
¶Setup model, tokenizer, and LoRA
Source code in toolboxv2/mods/isaa/base/rl/training.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
train(dataset, reward_funcs=None)
¶Train with configured method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Training dataset |
required | |
reward_funcs
|
list[Callable]
|
Reward functions for GRPO |
None
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
train_grpo(dataset, reward_funcs=None)
¶Train with GRPO (Group Relative Policy Optimization).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
HuggingFace Dataset with prompt, completions, rewards |
required | |
reward_funcs
|
list[Callable]
|
Optional list of reward functions for online rewards |
None
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
train_kto(dataset)
¶Train with KTO (Kahneman-Tversky Optimization).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
HuggingFace Dataset with prompt, completion, label |
required |
Source code in toolboxv2/mods/isaa/base/rl/training.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
RLTrainingManager
¶
Singleton manager for RL training sessions. Handles non-blocking training, status tracking, and model switching.
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
check_training_status()
¶Check the status of current or last training session.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with detailed training status |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
list_models()
¶List all available trained models
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
start_training(model_name, base_model='Qwen/Qwen2.5-0.5B-Instruct', method='grpo', agent_name='default', num_epochs=3, learning_rate=5e-05)
¶Start a non-blocking training session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the trained model |
required |
base_model
|
str
|
HuggingFace base model to fine-tune |
'Qwen/Qwen2.5-0.5B-Instruct'
|
method
|
str
|
Training method ("grpo" or "kto") |
'grpo'
|
agent_name
|
str
|
Agent name for data collection |
'default'
|
num_epochs
|
int
|
Number of training epochs |
3
|
learning_rate
|
float
|
Learning rate |
5e-05
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with session_id and status |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
stop_training(deploy=True, model_name=None)
¶Stop current training, save model, and optionally deploy to Ollama.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deploy
|
bool
|
Whether to deploy the model to Ollama after saving |
True
|
model_name
|
Optional[str]
|
Custom name for the deployed model (default: toolbox-{model_name}) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with status and deployed model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
switch_model(model_name)
¶Switch to a different trained model for inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name of the model to switch to |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with status and model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
ReasoningStep
dataclass
¶
Single reasoning step from LLMReasonerNode
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
36 37 38 39 40 41 42 43 | |
RewardEngine
¶
Combines multiple reward functions for GRPO training.
Provides weighted combination of rewards and normalization for group-based advantage computation.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
__init__(rewards=None)
¶Initialize reward engine with reward functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rewards
|
list[BaseReward]
|
List of reward functions (uses defaults if None) |
None
|
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
compute_all(trace)
¶Compute all rewards for a trace
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
670 671 672 673 674 675 676 677 678 679 680 681 682 | |
compute_combined(trace)
¶Compute weighted combined reward
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | |
compute_for_group(traces)
¶Compute rewards for a group of traces (for GRPO).
Returns normalized rewards suitable for advantage computation.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
get_binary_label(trace, threshold=0.6)
¶Get binary label for KTO training
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
722 723 724 725 | |
summary(trace)
¶Get human-readable reward summary
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
RewardResult
dataclass
¶
Result from a reward function evaluation
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
20 21 22 23 24 25 26 27 28 29 30 | |
to_binary(threshold=0.5)
¶Convert to binary reward (0 or 1)
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
28 29 30 | |
SyntaxValidationReward
¶
Bases: BaseReward
Reward for syntactically correct code.
Checks if code can be parsed without execution. Fast binary reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
compute(trace)
¶Check syntax of all code blocks
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
TaskCompletionReward
¶
Bases: BaseReward
Reward based on task completion status.
Checks if the agent actually completed the tasks it created.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
compute(trace)
¶Check task completion rate
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
ToolCallTrace
dataclass
¶
Single tool call with inputs, outputs, and success status
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
ToolSuccessReward
¶
Bases: BaseReward
Reward based on actual tool call success.
Looks at what tools the agent called and whether they succeeded. This directly examines agent behavior, not just output.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
compute(trace)
¶Compute reward from tool call success rate
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
TraceCollector
¶
Collects execution traces from FlowAgent.
Hooks into agent execution to capture detailed information about what the agent actually did, not just the final response.
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
__init__(storage_path=None)
¶Initialize trace collector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_path
|
Optional[str]
|
Where to store collected traces |
None
|
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
finish_trace(final_response, total_tokens_in=0, total_tokens_out=0, total_cost=0.0, execution_duration_ms=0.0, llm_calls_count=0)
¶Complete the current trace and save it
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
get_statistics()
¶Get statistics about collected traces
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_unlabeled_traces(limit=100)
¶Get traces that need manual labeling
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
320 321 322 323 324 | |
label_trace(trace_id, label, notes='')
¶Apply manual label to a trace
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
load_traces(start_date=None, end_date=None, labeled_only=False, min_tool_calls=0)
¶Load traces from storage with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
Optional[str]
|
Filter traces from this date (YYYY-MM-DD) |
None
|
end_date
|
Optional[str]
|
Filter traces until this date |
None
|
labeled_only
|
bool
|
Only return traces that have been labeled |
False
|
min_tool_calls
|
int
|
Minimum number of tool calls required |
0
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
record_reasoning_step(step_type, content, confidence=0.0, insights=None, issues=None)
¶Record a reasoning step
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
record_task(task_data, status)
¶Record task creation/completion/failure
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
record_tool_call(tool_name, arguments, result, success, duration_ms, error=None)
¶Record a tool call during execution
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
start_trace(session_id, user_query)
¶Start collecting a new execution trace
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
156 157 158 159 160 161 162 163 | |
TrainingConfig
dataclass
¶
Configuration for RL training
Source code in toolboxv2/mods/isaa/base/rl/training.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
from_hardware_config(hw_config, **overrides)
classmethod
¶Create TrainingConfig from HardwareConfig
Source code in toolboxv2/mods/isaa/base/rl/training.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
load(path)
classmethod
¶Load config from JSON
Source code in toolboxv2/mods/isaa/base/rl/training.py
119 120 121 122 123 124 | |
save(path)
¶Save config to JSON
Source code in toolboxv2/mods/isaa/base/rl/training.py
114 115 116 117 | |
TrainingPipeline
¶
Complete training pipeline from traces to trained model.
Combines data collection, dataset building, and training.
Source code in toolboxv2/mods/isaa/base/rl/training.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
deploy_to_ollama(model_name=None)
¶Deploy to Ollama
Source code in toolboxv2/mods/isaa/base/rl/training.py
597 598 599 600 601 602 603 604 605 606 | |
export_to_gguf(quantization='Q4_K_M')
¶Export to GGUF format
Source code in toolboxv2/mods/isaa/base/rl/training.py
588 589 590 591 592 593 594 595 | |
prepare_data(min_examples=2)
¶Prepare training dataset from traces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_examples
|
int
|
Minimum number of examples required for training |
2
|
Returns:
| Type | Description |
|---|---|
Any
|
HuggingFace Dataset ready for training |
Raises:
| Type | Description |
|---|---|
ValueError
|
If not enough training examples are available |
Source code in toolboxv2/mods/isaa/base/rl/training.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | |
run_full_pipeline(reward_funcs=None, deploy_ollama=True)
¶Run complete pipeline: data -> train -> export -> deploy
Source code in toolboxv2/mods/isaa/base/rl/training.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
save(merge_lora=True)
¶Save trained model
Source code in toolboxv2/mods/isaa/base/rl/training.py
581 582 583 584 585 586 | |
train(dataset=None, reward_funcs=None, min_examples=2)
¶Run training.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Pre-prepared dataset (optional, will prepare if None) |
None
|
|
reward_funcs
|
list[Callable]
|
Reward functions for GRPO |
None
|
min_examples
|
int
|
Minimum examples required for training |
2
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
TrainingSession
dataclass
¶
Represents an active training session
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
TrainingState
¶
Bases: Enum
Training state enum
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
22 23 24 25 26 27 28 29 | |
check_training_status()
async
¶
Check the status of current or last RL training session.
Returns detailed information about training progress, including: - Current state (running, completed, failed) - Progress percentage - Elapsed time - Current loss
Returns:
| Type | Description |
|---|---|
str
|
Formatted status report |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
detect_hardware(storage_path=None)
¶
Detect system hardware and return optimized configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_path
|
Optional[str]
|
Path for model storage (default: ~/.toolbox/models) |
None
|
Returns:
| Type | Description |
|---|---|
HardwareConfig
|
HardwareConfig with detected and optimized settings |
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
get_rl_training_tools()
¶
Get all RL training tools for agent registration.
Returns:
| Type | Description |
|---|---|
list[tuple[Callable, str, str]]
|
List of (function, name, description) tuples |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
get_ryzen_optimized_config(storage_path=None)
¶
Get Ryzen-optimized configuration (for Ryzen 9 5950X specifically).
This is a preset for the known hardware configuration.
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
list_rl_models()
async
¶
List all available trained RL models.
Shows all models that have been trained, including their training method, state, and whether they're deployed.
Returns:
| Type | Description |
|---|---|
str
|
Formatted list of models |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | |
quick_export(model_path, model_name='toolbox-agent', quantization='Q4_K_M')
¶
Quick export function for simple use cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to HuggingFace model |
required |
model_name
|
str
|
Name for Ollama model |
'toolbox-agent'
|
quantization
|
str
|
GGUF quantization type |
'Q4_K_M'
|
Returns:
| Type | Description |
|---|---|
str
|
Ollama model name |
Source code in toolboxv2/mods/isaa/base/rl/export.py
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | |
register_rl_tools(agent)
¶
Register all RL training tools with a FlowAgent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance to register tools with |
required |
Example
from toolboxv2.mods.isaa.base.rl.agent_tools import register_rl_tools register_rl_tools(my_agent)
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | |
start_rl_training(model_name, base_model='Qwen/Qwen2.5-0.5B-Instruct', method='grpo', agent_name='default', num_epochs=3)
async
¶
Start RL training for a new model (non-blocking).
This starts training in the background and returns immediately. Use check_training_status to monitor progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the trained model (e.g., "my-assistant-v1") |
required |
base_model
|
str
|
HuggingFace base model to fine-tune (default: Qwen2.5-0.5B) |
'Qwen/Qwen2.5-0.5B-Instruct'
|
method
|
str
|
Training method - "grpo" or "kto" (default: grpo) |
'grpo'
|
agent_name
|
str
|
Agent name for collecting training data (default: default) |
'default'
|
num_epochs
|
int
|
Number of training epochs (default: 3) |
3
|
Returns:
| Type | Description |
|---|---|
str
|
Status message with session ID |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
stop_rl_training(deploy=True)
async
¶
Stop current RL training, save the model, and optionally deploy to Ollama.
This will save the current training progress and create a usable model. If deploy=True, the model will be converted to GGUF and deployed to Ollama.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deploy
|
bool
|
Whether to deploy the model to Ollama (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Status message with saved model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
switch_rl_model(model_name)
async
¶
Switch to a different trained RL model for inference.
This will activate a previously trained model. If the model hasn't been deployed to Ollama yet, it will be deployed automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name of the model to switch to |
required |
Returns:
| Type | Description |
|---|---|
str
|
Status message with model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | |
agent_tools
¶
RL Training Agent Tools
Provides 4 tools for FlowAgent to manage RL training: 1. start_training - Start non-blocking training 2. stop_training - Stop training with auto-save and deploy 3. check_training_status - Check current training status 4. switch_model - Switch to a different trained model
RLTrainingManager
¶Singleton manager for RL training sessions. Handles non-blocking training, status tracking, and model switching.
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
check_training_status()
¶Check the status of current or last training session.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with detailed training status |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
list_models()
¶List all available trained models
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
start_training(model_name, base_model='Qwen/Qwen2.5-0.5B-Instruct', method='grpo', agent_name='default', num_epochs=3, learning_rate=5e-05)
¶Start a non-blocking training session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the trained model |
required |
base_model
|
str
|
HuggingFace base model to fine-tune |
'Qwen/Qwen2.5-0.5B-Instruct'
|
method
|
str
|
Training method ("grpo" or "kto") |
'grpo'
|
agent_name
|
str
|
Agent name for data collection |
'default'
|
num_epochs
|
int
|
Number of training epochs |
3
|
learning_rate
|
float
|
Learning rate |
5e-05
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with session_id and status |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
stop_training(deploy=True, model_name=None)
¶Stop current training, save model, and optionally deploy to Ollama.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deploy
|
bool
|
Whether to deploy the model to Ollama after saving |
True
|
model_name
|
Optional[str]
|
Custom name for the deployed model (default: toolbox-{model_name}) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with status and deployed model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
switch_model(model_name)
¶Switch to a different trained model for inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name of the model to switch to |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with status and model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
TrainingSession
dataclass
¶Represents an active training session
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
TrainingState
¶
Bases: Enum
Training state enum
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
22 23 24 25 26 27 28 29 | |
check_training_status()
async
¶Check the status of current or last RL training session.
Returns detailed information about training progress, including: - Current state (running, completed, failed) - Progress percentage - Elapsed time - Current loss
Returns:
| Type | Description |
|---|---|
str
|
Formatted status report |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
get_rl_training_tools()
¶Get all RL training tools for agent registration.
Returns:
| Type | Description |
|---|---|
list[tuple[Callable, str, str]]
|
List of (function, name, description) tuples |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
list_rl_models()
async
¶List all available trained RL models.
Shows all models that have been trained, including their training method, state, and whether they're deployed.
Returns:
| Type | Description |
|---|---|
str
|
Formatted list of models |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | |
register_rl_tools(agent)
¶Register all RL training tools with a FlowAgent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
FlowAgent instance to register tools with |
required |
Example
from toolboxv2.mods.isaa.base.rl.agent_tools import register_rl_tools register_rl_tools(my_agent)
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | |
start_rl_training(model_name, base_model='Qwen/Qwen2.5-0.5B-Instruct', method='grpo', agent_name='default', num_epochs=3)
async
¶Start RL training for a new model (non-blocking).
This starts training in the background and returns immediately. Use check_training_status to monitor progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the trained model (e.g., "my-assistant-v1") |
required |
base_model
|
str
|
HuggingFace base model to fine-tune (default: Qwen2.5-0.5B) |
'Qwen/Qwen2.5-0.5B-Instruct'
|
method
|
str
|
Training method - "grpo" or "kto" (default: grpo) |
'grpo'
|
agent_name
|
str
|
Agent name for collecting training data (default: default) |
'default'
|
num_epochs
|
int
|
Number of training epochs (default: 3) |
3
|
Returns:
| Type | Description |
|---|---|
str
|
Status message with session ID |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
stop_rl_training(deploy=True)
async
¶Stop current RL training, save the model, and optionally deploy to Ollama.
This will save the current training progress and create a usable model. If deploy=True, the model will be converted to GGUF and deployed to Ollama.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deploy
|
bool
|
Whether to deploy the model to Ollama (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Status message with saved model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
switch_rl_model(model_name)
async
¶Switch to a different trained RL model for inference.
This will activate a previously trained model. If the model hasn't been deployed to Ollama yet, it will be deployed automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name of the model to switch to |
required |
Returns:
| Type | Description |
|---|---|
str
|
Status message with model info |
Source code in toolboxv2/mods/isaa/base/rl/agent_tools.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | |
data_collection
¶
Data Collection for FlowAgent RL Training
Collects training traces from FlowAgent checkpoints and runtime. Extracts detailed execution information including tool calls, reasoning steps, and actual outcomes - not just final outputs.
CheckpointLoader
¶Loads and extracts training data from FlowAgent checkpoints.
Handles overlapping data from multiple checkpoints and deduplicates based on trace IDs.
Checkpoint Structure (AgentCheckpoint): - session_data: dict[session_id, {history: [{role, content}, ...], session_type}] - variable_scopes: dict[scope_name, {var_name: value}] - task_state: dict[task_id, task_dict] - conversation_history: list[{role, content}] - agent_state: dict with is_running, is_paused, tokens, costs - tool_capabilities: dict[tool_name, capability_info]
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
__init__(agent_name=None, checkpoint_path=None)
¶Initialize checkpoint loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
Optional[str]
|
Name of the FlowAgent (optional if using discover_all_agents) |
None
|
checkpoint_path
|
Optional[str]
|
Path to checkpoint directory or base checkpoint folder |
None
|
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
discover_all_agents()
¶Discover all agent names that have checkpoints.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of agent names with available checkpoints |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
extract_traces_from_checkpoint(checkpoint, agent_name=None)
¶Extract execution traces from a checkpoint.
Looks into: - session_data for conversation history (primary source) - variable_scopes for context and delegation info - task_state for task execution details - agent_state for token/cost metrics - tool_capabilities for available tools
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint
|
AgentCheckpoint object |
required | |
agent_name
|
str
|
Optional agent name for metadata |
None
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
generate_synthetic_tasks(num_tasks=100)
¶Generate synthetic training tasks from checkpoint data.
Analyzes patterns in successful executions to create similar training prompts.
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
get_training_statistics()
¶Get comprehensive statistics about available training data.
Returns:
| Type | Description |
|---|---|
dict
|
Dict with statistics about traces, sessions, tools, etc. |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | |
list_checkpoints()
¶List available checkpoints with metadata
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
load_all_agents_traces(deduplicate=True)
¶Load traces from all agents' checkpoints.
Returns:
| Type | Description |
|---|---|
dict[str, list[ExecutionTrace]]
|
Dict mapping agent_name -> list of ExecutionTrace |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
load_all_traces(deduplicate=True, max_age_hours=None)
¶Load traces from all checkpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deduplicate
|
bool
|
Remove duplicate traces based on trace_id |
True
|
max_age_hours
|
int
|
Only load checkpoints newer than this (None = all) |
None
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of unique ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
load_checkpoint(filepath)
¶Load a single checkpoint file
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
432 433 434 435 | |
ExecutionTrace
dataclass
¶Complete execution trace for a single agent run
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
from_dict(data)
classmethod
¶Reconstruct from dict
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
to_dict()
¶Convert to serializable dict
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
89 90 91 92 93 94 95 96 97 | |
ReasoningStep
dataclass
¶Single reasoning step from LLMReasonerNode
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
36 37 38 39 40 41 42 43 | |
ToolCallTrace
dataclass
¶Single tool call with inputs, outputs, and success status
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
TraceCollector
¶Collects execution traces from FlowAgent.
Hooks into agent execution to capture detailed information about what the agent actually did, not just the final response.
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
__init__(storage_path=None)
¶Initialize trace collector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_path
|
Optional[str]
|
Where to store collected traces |
None
|
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
finish_trace(final_response, total_tokens_in=0, total_tokens_out=0, total_cost=0.0, execution_duration_ms=0.0, llm_calls_count=0)
¶Complete the current trace and save it
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
get_statistics()
¶Get statistics about collected traces
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_unlabeled_traces(limit=100)
¶Get traces that need manual labeling
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
320 321 322 323 324 | |
label_trace(trace_id, label, notes='')
¶Apply manual label to a trace
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
load_traces(start_date=None, end_date=None, labeled_only=False, min_tool_calls=0)
¶Load traces from storage with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
Optional[str]
|
Filter traces from this date (YYYY-MM-DD) |
None
|
end_date
|
Optional[str]
|
Filter traces until this date |
None
|
labeled_only
|
bool
|
Only return traces that have been labeled |
False
|
min_tool_calls
|
int
|
Minimum number of tool calls required |
0
|
Returns:
| Type | Description |
|---|---|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
record_reasoning_step(step_type, content, confidence=0.0, insights=None, issues=None)
¶Record a reasoning step
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
record_task(task_data, status)
¶Record task creation/completion/failure
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
record_tool_call(tool_name, arguments, result, success, duration_ms, error=None)
¶Record a tool call during execution
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
start_trace(session_id, user_query)
¶Start collecting a new execution trace
Source code in toolboxv2/mods/isaa/base/rl/data_collection.py
156 157 158 159 160 161 162 163 | |
dataset_builder
¶
Dataset Builder for KTO and GRPO Training
Converts ExecutionTraces into training datasets suitable for TRL's KTOTrainer and GRPOTrainer.
DatasetPipeline
¶Complete pipeline for building training datasets from FlowAgent.
Combines trace collection, reward computation, and dataset building.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
build_grpo_dataset(output_path, **kwargs)
¶Build and save GRPO dataset
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
635 636 637 638 639 640 641 642 643 644 | |
build_kto_dataset(output_path, **kwargs)
¶Build and save KTO dataset
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
624 625 626 627 628 629 630 631 632 633 | |
collect_all_traces()
¶Collect traces from all sources
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
get_pipeline_statistics()
¶Get comprehensive pipeline statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
654 655 656 657 658 659 660 661 662 663 664 665 | |
get_unlabeled_for_review(limit=50)
¶Get traces that need manual review
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
646 647 648 | |
label_trace(trace_id, label, notes='')
¶Apply manual label
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
650 651 652 | |
GRPODatasetBuilder
¶Builds GRPO (Group Relative Policy Optimization) datasets.
GRPO requires multiple completions per prompt with rewards, enabling contrastive learning within groups.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
__init__(reward_engine=None, num_completions=4, system_prompt='')
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reward_engine
|
Optional[RewardEngine]
|
For computing rewards |
None
|
num_completions
|
int
|
Target completions per prompt |
4
|
system_prompt
|
str
|
System prompt for all examples |
''
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
build_dataset(traces, min_group_size=2, max_examples=None, include_singles=True)
¶Build GRPO dataset from traces.
Groups traces by query and creates examples with multiple completions per prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
required |
min_group_size
|
int
|
Minimum traces per group for contrastive learning |
2
|
max_examples
|
int
|
Maximum total examples |
None
|
include_singles
|
bool
|
Include single traces with synthetic variations |
True
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
build_example_from_group(prompt, traces)
¶Build GRPO example from a group of traces with same prompt
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
build_synthetic_groups(traces, agent_generate_func, num_generations=4)
¶Build GRPO dataset by generating multiple completions per prompt.
Uses the agent to generate additional completions for each unique query, enabling GRPO even with single-trace data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
Existing traces (one per query) |
required |
agent_generate_func
|
Callable
|
async func(prompt) -> str |
required |
num_generations
|
int
|
Completions per prompt |
4
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
get_statistics(examples)
¶Get dataset statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
group_traces_by_query(traces)
¶Group traces by similar queries
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
load_dataset(input_path)
¶Load GRPO dataset from file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
save_dataset(examples, output_path, format='jsonl')
¶Save GRPO dataset to file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
to_hf_dataset(examples)
¶Convert to HuggingFace Dataset format for TRL GRPOTrainer
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
GRPOExample
dataclass
¶Single example for GRPO training with multiple completions
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
33 34 35 36 37 38 39 40 41 42 43 44 45 | |
KTODatasetBuilder
¶Builds KTO (Kahneman-Tversky Optimization) datasets from traces.
KTO uses binary feedback (good/bad) rather than preference pairs. Better suited for FlowAgent where we have verifiable outcomes.
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
__init__(reward_engine=None, reward_threshold=0.6, system_prompt='')
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reward_engine
|
Optional[RewardEngine]
|
For computing rewards (uses default if None) |
None
|
reward_threshold
|
float
|
Score threshold for positive label |
0.6
|
system_prompt
|
str
|
System prompt to prepend to all prompts |
''
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
build_dataset(traces, balance=True, max_examples=None)
¶Build KTO dataset from traces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traces
|
list[ExecutionTrace]
|
List of ExecutionTrace objects |
required |
balance
|
bool
|
Balance positive/negative examples |
True
|
max_examples
|
int
|
Maximum total examples |
None
|
Returns:
| Type | Description |
|---|---|
list[KTOExample]
|
List of KTOExample objects |
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
build_from_checkpoints(loader, **kwargs)
¶Build dataset from checkpoints
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
146 147 148 149 150 151 152 153 | |
build_from_collector(collector, include_unlabeled=True, **kwargs)
¶Build dataset from TraceCollector
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
136 137 138 139 140 141 142 143 144 | |
get_statistics(examples)
¶Get dataset statistics
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
load_dataset(input_path)
¶Load dataset from file
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
save_dataset(examples, output_path, format='jsonl')
¶Save dataset to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
examples
|
list[KTOExample]
|
KTO examples |
required |
output_path
|
str
|
Output file path |
required |
format
|
str
|
"jsonl" or "json" |
'jsonl'
|
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
to_hf_dataset(examples)
¶Convert to HuggingFace Dataset format
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
trace_to_example(trace)
¶Convert single trace to KTO example
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
KTOExample
dataclass
¶Single example for KTO training
Source code in toolboxv2/mods/isaa/base/rl/dataset_builder.py
18 19 20 21 22 23 24 25 26 27 28 29 30 | |
export
¶
Export Module for RL-Trained Models
Handles GGUF conversion and Ollama deployment with Ryzen-optimized and auto-detect hosting profiles.
ExportPipeline
¶Complete export pipeline from trained model to deployed Ollama.
Source code in toolboxv2/mods/isaa/base/rl/export.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
run(quantization='Q4_K_M', system_prompt='', hosting_profile='auto')
¶Run complete export pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantization
|
str
|
GGUF quantization type |
'Q4_K_M'
|
system_prompt
|
str
|
System prompt for Ollama model |
''
|
hosting_profile
|
str
|
"ryzen" or "auto" |
'auto'
|
Returns:
| Type | Description |
|---|---|
dict
|
Pipeline results |
Source code in toolboxv2/mods/isaa/base/rl/export.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
GGUFExporter
¶Export HuggingFace models to GGUF format for llama.cpp/Ollama.
Requires llama.cpp to be installed or will clone it automatically.
Source code in toolboxv2/mods/isaa/base/rl/export.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
__init__(model_path, llama_cpp_path=None, output_dir=None)
¶Initialize exporter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to HuggingFace model directory |
required |
llama_cpp_path
|
Optional[str]
|
Path to llama.cpp installation |
None
|
output_dir
|
Optional[str]
|
Output directory for GGUF files |
None
|
Source code in toolboxv2/mods/isaa/base/rl/export.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
convert(quantization='Q4_K_M', output_name=None)
¶Convert HuggingFace model to GGUF.
The conversion is a two-step process: 1. Convert HF model to F16 GGUF using convert_hf_to_gguf.py 2. Quantize to target format using llama-quantize (if not F16/F32)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantization
|
str
|
Quantization type (Q4_K_M, Q8_0, F16, etc.) |
'Q4_K_M'
|
output_name
|
Optional[str]
|
Output filename (default: model-{quantization}.gguf) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to GGUF file |
Source code in toolboxv2/mods/isaa/base/rl/export.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
get_recommended_quantization(available_ram_gb=8.0)
¶Get recommended quantization based on available RAM
Source code in toolboxv2/mods/isaa/base/rl/export.py
272 273 274 275 276 277 278 279 280 281 282 283 | |
GGUFQuantization
dataclass
¶GGUF quantization options
Source code in toolboxv2/mods/isaa/base/rl/export.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
OllamaDeployer
¶Deploy GGUF models to Ollama with optimized hosting profiles.
Source code in toolboxv2/mods/isaa/base/rl/export.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
__init__(ollama_path='ollama')
¶Initialize deployer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ollama_path
|
str
|
Path to ollama executable |
'ollama'
|
Source code in toolboxv2/mods/isaa/base/rl/export.py
318 319 320 321 322 323 324 325 326 | |
create_model(model_name, gguf_path, system_prompt='', temperature=0.7, num_ctx=4096)
¶Create Ollama model from GGUF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name for the Ollama model |
required |
gguf_path
|
str
|
Path to GGUF file |
required |
system_prompt
|
str
|
System prompt |
''
|
temperature
|
float
|
Default temperature |
0.7
|
num_ctx
|
int
|
Context window |
4096
|
Returns:
| Type | Description |
|---|---|
str
|
Model name |
Source code in toolboxv2/mods/isaa/base/rl/export.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
create_modelfile(gguf_path, system_prompt='', temperature=0.7, num_ctx=4096, stop_tokens=None)
¶Create Ollama Modelfile content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gguf_path
|
str
|
Path to GGUF file |
required |
system_prompt
|
str
|
System prompt for the model |
''
|
temperature
|
float
|
Default temperature |
0.7
|
num_ctx
|
int
|
Context window size |
4096
|
stop_tokens
|
list[str]
|
Stop sequences |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Modelfile content as string |
Source code in toolboxv2/mods/isaa/base/rl/export.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
delete_model(model_name)
¶Delete an Ollama model
Source code in toolboxv2/mods/isaa/base/rl/export.py
476 477 478 479 480 481 482 483 484 485 | |
get_auto_profile()
¶Auto-detect optimal hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
get_ryzen_profile(cpu_cores=16)
¶Get Ryzen-optimized hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
502 503 504 505 506 507 508 509 510 | |
list_models()
¶List installed Ollama models
Source code in toolboxv2/mods/isaa/base/rl/export.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
run_model(model_name, prompt)
¶Run a prompt through the model
Source code in toolboxv2/mods/isaa/base/rl/export.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
start_server_with_profile(profile)
¶Start Ollama server with hosting profile
Source code in toolboxv2/mods/isaa/base/rl/export.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
OllamaHostingProfile
dataclass
¶Hosting profile for Ollama
Source code in toolboxv2/mods/isaa/base/rl/export.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
to_env()
¶Convert to environment variables
Source code in toolboxv2/mods/isaa/base/rl/export.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
quick_export(model_path, model_name='toolbox-agent', quantization='Q4_K_M')
¶Quick export function for simple use cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to HuggingFace model |
required |
model_name
|
str
|
Name for Ollama model |
'toolbox-agent'
|
quantization
|
str
|
GGUF quantization type |
'Q4_K_M'
|
Returns:
| Type | Description |
|---|---|
str
|
Ollama model name |
Source code in toolboxv2/mods/isaa/base/rl/export.py
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | |
hardware_config
¶
Hardware Configuration and Detection for RL Training
Detects system capabilities (CPU, RAM, GPU) and provides optimized training configurations for Ryzen and auto-detection modes.
HardwareConfig
dataclass
¶Hardware configuration for training optimization
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
get_torch_dtype()
¶Return the appropriate torch dtype
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
129 130 131 132 133 134 135 | |
get_training_device()
¶Return the device string for training
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
123 124 125 126 127 | |
summary()
¶Human-readable summary
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
to_grpo_config()
¶Convert to GRPO-specific config
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
160 161 162 163 164 165 166 | |
to_lora_config()
¶Convert to LoRA config dict
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
149 150 151 152 153 154 155 156 157 158 | |
to_training_args()
¶Convert to training arguments dict
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
137 138 139 140 141 142 143 144 145 146 147 | |
detect_hardware(storage_path=None)
¶Detect system hardware and return optimized configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_path
|
Optional[str]
|
Path for model storage (default: ~/.toolbox/models) |
None
|
Returns:
| Type | Description |
|---|---|
HardwareConfig
|
HardwareConfig with detected and optimized settings |
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
get_ryzen_optimized_config(storage_path=None)
¶Get Ryzen-optimized configuration (for Ryzen 9 5950X specifically).
This is a preset for the known hardware configuration.
Source code in toolboxv2/mods/isaa/base/rl/hardware_config.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
reward_functions
¶
Reward Functions for FlowAgent RL Training
Verifiable binary and soft rewards that look into what the agent actually did - not just the final output. Includes code execution, tool success, syntax validation, and learned rewards.
BaseReward
¶
Bases: ABC
Abstract base class for reward functions
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
compute(trace)
abstractmethod
¶Compute reward for an execution trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace
|
ExecutionTrace object with full execution details |
required |
Returns:
| Type | Description |
|---|---|
RewardResult
|
RewardResult with score and details |
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
CodeExecutionReward
¶
Bases: BaseReward
Reward for successful code execution.
Actually runs the code and checks if it executes without errors. This is a verifiable binary reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
__init__(timeout=30, sandbox=True)
¶Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int
|
Max execution time in seconds |
30
|
sandbox
|
bool
|
Use restricted execution environment |
True
|
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
69 70 71 72 73 74 75 76 | |
compute(trace)
¶Check if code in the response executes successfully
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
EfficiencyReward
¶
Bases: BaseReward
Soft reward for efficiency.
Rewards concise, efficient responses that don't waste tokens or make unnecessary tool calls.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
compute(trace)
¶Compute efficiency score
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
FormatComplianceReward
¶
Bases: BaseReward
Reward for following output format requirements.
Checks if the response follows expected formatting patterns (NO XML - plain text focus).
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
compute(trace)
¶Check format compliance
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
LearnedReward
¶
Bases: BaseReward
Learned reward from manual labels.
Uses a simple pattern matching model trained on manually labeled examples to predict reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
compute(trace)
¶Compute reward using learned patterns
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | |
learn_from_traces(traces, min_examples=10)
¶Learn patterns from labeled traces.
Simple approach: extract n-grams and tool patterns from positive and negative examples.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
save_patterns()
¶Save learned patterns
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
535 536 537 538 539 540 | |
RewardEngine
¶Combines multiple reward functions for GRPO training.
Provides weighted combination of rewards and normalization for group-based advantage computation.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
__init__(rewards=None)
¶Initialize reward engine with reward functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rewards
|
list[BaseReward]
|
List of reward functions (uses defaults if None) |
None
|
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
compute_all(trace)
¶Compute all rewards for a trace
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
670 671 672 673 674 675 676 677 678 679 680 681 682 | |
compute_combined(trace)
¶Compute weighted combined reward
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | |
compute_for_group(traces)
¶Compute rewards for a group of traces (for GRPO).
Returns normalized rewards suitable for advantage computation.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
get_binary_label(trace, threshold=0.6)
¶Get binary label for KTO training
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
722 723 724 725 | |
summary(trace)
¶Get human-readable reward summary
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
RewardResult
dataclass
¶Result from a reward function evaluation
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
20 21 22 23 24 25 26 27 28 29 30 | |
to_binary(threshold=0.5)
¶Convert to binary reward (0 or 1)
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
28 29 30 | |
SyntaxValidationReward
¶
Bases: BaseReward
Reward for syntactically correct code.
Checks if code can be parsed without execution. Fast binary reward.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
compute(trace)
¶Check syntax of all code blocks
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
TaskCompletionReward
¶
Bases: BaseReward
Reward based on task completion status.
Checks if the agent actually completed the tasks it created.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
compute(trace)
¶Check task completion rate
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
ToolSuccessReward
¶
Bases: BaseReward
Reward based on actual tool call success.
Looks at what tools the agent called and whether they succeeded. This directly examines agent behavior, not just output.
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
compute(trace)
¶Compute reward from tool call success rate
Source code in toolboxv2/mods/isaa/base/rl/reward_functions.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
training
¶
RL Training Module for FlowAgent
LoRA-based GRPO and KTO training with TRL library. Supports CPU and GPU training with automatic hardware detection.
RLTrainer
¶Main trainer class for GRPO/KTO training with LoRA.
Handles the complete training lifecycle: 1. Load base model 2. Apply LoRA adapters 3. Train with GRPO or KTO 4. Save merged model
Source code in toolboxv2/mods/isaa/base/rl/training.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
__init__(config)
¶Initialize trainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TrainingConfig
|
TrainingConfig with all settings |
required |
Source code in toolboxv2/mods/isaa/base/rl/training.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
evaluate(eval_dataset, metrics=None)
¶Evaluate model on dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eval_dataset
|
Evaluation dataset |
required | |
metrics
|
list[str]
|
List of metrics to compute |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of evaluation results |
Source code in toolboxv2/mods/isaa/base/rl/training.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
get_training_summary()
¶Get human-readable training summary
Source code in toolboxv2/mods/isaa/base/rl/training.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
save_model(output_path=None, merge_lora=True)
¶Save trained model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Optional[str]
|
Output directory (default: config.output_dir/final) |
None
|
merge_lora
|
bool
|
Merge LoRA weights into base model |
True
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
setup()
¶Setup model, tokenizer, and LoRA
Source code in toolboxv2/mods/isaa/base/rl/training.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
train(dataset, reward_funcs=None)
¶Train with configured method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Training dataset |
required | |
reward_funcs
|
list[Callable]
|
Reward functions for GRPO |
None
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
train_grpo(dataset, reward_funcs=None)
¶Train with GRPO (Group Relative Policy Optimization).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
HuggingFace Dataset with prompt, completions, rewards |
required | |
reward_funcs
|
list[Callable]
|
Optional list of reward functions for online rewards |
None
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
train_kto(dataset)
¶Train with KTO (Kahneman-Tversky Optimization).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
HuggingFace Dataset with prompt, completion, label |
required |
Source code in toolboxv2/mods/isaa/base/rl/training.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
TrainingConfig
dataclass
¶Configuration for RL training
Source code in toolboxv2/mods/isaa/base/rl/training.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
from_hardware_config(hw_config, **overrides)
classmethod
¶Create TrainingConfig from HardwareConfig
Source code in toolboxv2/mods/isaa/base/rl/training.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
load(path)
classmethod
¶Load config from JSON
Source code in toolboxv2/mods/isaa/base/rl/training.py
119 120 121 122 123 124 | |
save(path)
¶Save config to JSON
Source code in toolboxv2/mods/isaa/base/rl/training.py
114 115 116 117 | |
TrainingPipeline
¶Complete training pipeline from traces to trained model.
Combines data collection, dataset building, and training.
Source code in toolboxv2/mods/isaa/base/rl/training.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
deploy_to_ollama(model_name=None)
¶Deploy to Ollama
Source code in toolboxv2/mods/isaa/base/rl/training.py
597 598 599 600 601 602 603 604 605 606 | |
export_to_gguf(quantization='Q4_K_M')
¶Export to GGUF format
Source code in toolboxv2/mods/isaa/base/rl/training.py
588 589 590 591 592 593 594 595 | |
prepare_data(min_examples=2)
¶Prepare training dataset from traces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_examples
|
int
|
Minimum number of examples required for training |
2
|
Returns:
| Type | Description |
|---|---|
Any
|
HuggingFace Dataset ready for training |
Raises:
| Type | Description |
|---|---|
ValueError
|
If not enough training examples are available |
Source code in toolboxv2/mods/isaa/base/rl/training.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | |
run_full_pipeline(reward_funcs=None, deploy_ollama=True)
¶Run complete pipeline: data -> train -> export -> deploy
Source code in toolboxv2/mods/isaa/base/rl/training.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
save(merge_lora=True)
¶Save trained model
Source code in toolboxv2/mods/isaa/base/rl/training.py
581 582 583 584 585 586 | |
train(dataset=None, reward_funcs=None, min_examples=2)
¶Run training.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Pre-prepared dataset (optional, will prepare if None) |
None
|
|
reward_funcs
|
list[Callable]
|
Reward functions for GRPO |
None
|
min_examples
|
int
|
Minimum examples required for training |
2
|
Source code in toolboxv2/mods/isaa/base/rl/training.py
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
extras
¶
adapter
¶
LiteLLM LLM Interface Module¶
This module provides interfaces for interacting with LiteLLM's language models, including text generation and embedding capabilities.
Author: Lightrag Team Created: 2025-02-04 License: MIT License Version: 1.0.0
Change Log: - 1.0.0 (2025-02-04): Initial LiteLLM release * Ported OpenAI logic to use litellm async client * Updated error types and environment variable names * Preserved streaming and embedding support
Dependencies
- litellm
- numpy
- pipmaster
- Python >= 3.10
Usage
from llm_interfaces.litellm import logging
if not hasattr(logging, 'NONE'): logging.NONE = 100
import litellm_complete, litellm_embed
litellm_complete(prompt, system_prompt=None, history_messages=None, keyword_extraction=False, model_name='groq/gemma2-9b-it', **kwargs)
async
¶
Public completion interface using the model name specified in the global configuration. Optionally extracts keywords if requested.
Source code in toolboxv2/mods/isaa/extras/adapter.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
litellm_complete_if_cache(model, prompt, system_prompt=None, history_messages=None, base_url=None, api_key=None, **kwargs)
async
¶
Core function to query the LiteLLM model. It builds the message context, invokes the completion API, and returns either a complete result string or an async iterator for streaming responses.
Source code in toolboxv2/mods/isaa/extras/adapter.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
litellm_embed(texts, model='gemini/text-embedding-004', dimensions=256, base_url=None, api_key=None)
async
¶
Generates embeddings for the given list of texts using LiteLLM.
Source code in toolboxv2/mods/isaa/extras/adapter.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
agent_ui
¶
FlowAgent UI v2 - Elegante Chat-UI mit Fokus auf Funktionalität¶
Inspiriert von DeepSeek/Claude UI - Minimalistisch, elegant, funktional.
Kernprinzipien: 1. Sofortiges visuelles Feedback bei jeder Aktion 2. Nur Buttons die 100% funktionieren 3. Eleganter, übersichtlicher Chat-Bereich 4. Dark/Light Theme mit CSS-Variablen
AgentChatView
¶
Bases: MinuView
Elegante Chat-UI für FlowAgent. Fokus auf Übersichtlichkeit und sofortiges User-Feedback.
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | |
clear_chat(event)
async
¶Clear all messages - 100% IMPLEMENTED
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1394 1395 1396 1397 1398 1399 1400 1401 1402 | |
create_new_session(event)
async
¶Neue Session erstellen
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | |
delete_session(event)
async
¶Session löschen
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | |
render()
¶Main render - Clean, minimal layout
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
153 154 155 156 157 158 159 160 | |
send_message(event)
async
¶Orchestrates the chat interaction and parses agent events.
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | |
stop_generation(event)
async
¶Stop current generation - 100% IMPLEMENTED
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | |
switch_session(event)
async
¶Session wechseln - event enthält session_id nach dem Doppelpunkt
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | |
toggle_session_manager(event)
async
¶Toggle Session Manager
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1517 1518 1519 1520 1521 | |
ChatMessage
dataclass
¶
Enhanced chat message with internal agent state tracking
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
initialize(app, **kwargs)
¶
Initialize Agent Chat UI module
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | |
register_agent_chat_ui()
¶
Register the Agent Chat UI view
Source code in toolboxv2/mods/isaa/extras/agent_ui.py
1614 1615 1616 | |
cahin_printer
¶
ChainPrinter
¶
Custom printer for enhanced chain visualization and progress display
Source code in toolboxv2/mods/isaa/extras/cahin_printer.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
print_chain_list(chains)
¶Print formatted list of available chains
Source code in toolboxv2/mods/isaa/extras/cahin_printer.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
print_header(title, subtitle=None)
¶Print formatted header
Source code in toolboxv2/mods/isaa/extras/cahin_printer.py
84 85 86 87 88 89 90 | |
ChainProgressTracker
¶
Enhanced progress tracker for chain execution with live display
Source code in toolboxv2/mods/isaa/extras/cahin_printer.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
emit_event(event)
async
¶Emit progress event with live display updates
Source code in toolboxv2/mods/isaa/extras/cahin_printer.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
modes
¶
generate_prompt(subject, context='', additional_requirements=None)
¶
Generates a prompt based on the given subject, with optional context and additional requirements.
Parameters: - subject (str): The main subject for the prompt. - context (str): Optional additional context to tailor the prompt. - additional_requirements (Dict[str, Any]): Optional additional parameters or requirements for the prompt.
Returns: - str: A crafted prompt.
Source code in toolboxv2/mods/isaa/extras/modes.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
terminal_progress
¶
AgentExecutionState
¶
Verwaltet den gesamten Zustand des Agentenablaufs, um eine reichhaltige Visualisierung zu ermöglichen.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
ProgressiveTreePrinter
¶
Eine moderne, produktionsreife Terminal-Visualisierung für den Agenten-Ablauf.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
clear()
staticmethod
¶Speichert aktuellen Terminal-Content und cleared das Terminal Systemagnostisch (Windows/Unix)
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
389 390 391 392 393 394 395 396 397 398 399 | |
live_print(*args, **kwargs)
¶Live print ohne Content-Speicherung für temporäre Ausgaben
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
383 384 385 386 387 | |
print(*args, **kwargs)
¶Überladene print Funktion die automatisch Content speichert
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
print_final_summary()
¶Zeigt die finale Zusammenfassung.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
progress_callback(event)
async
¶Haupteingangspunkt für Progress Events.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
restore_content()
¶Stellt den gespeicherten Terminal-Content in einer Aktion wieder her Effizient durch join operation
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
401 402 403 404 405 406 407 408 409 | |
StateProcessor
¶
Verarbeitet ProgressEvents und aktualisiert den AgentExecutionState.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
arguments_summary(tool_args, max_length=50)
¶
Creates a summary of the tool arguments for display purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_args
|
dict[str, Any]
|
Dictionary containing tool arguments |
required |
max_length
|
int
|
Maximum length for individual argument values in summary |
50
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string summary of the arguments |
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
human_readable_time(seconds)
¶
Konvertiert Sekunden in ein menschlich lesbares Format.
Source code in toolboxv2/mods/isaa/extras/terminal_progress.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
verbose_output
¶
DynamicVerboseFormatter
¶
Unified, dynamic formatter that adapts to screen size
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
get_git_info()
¶Checks for a git repo and returns its name and branch, or None.
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
print_code_block(code, language='python')
¶Print code with syntax awareness and proper formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
print_debug(message)
¶Print debug message with consistent formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
336 337 338 | |
print_error(message)
¶Print error message with consistent formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
320 321 322 | |
print_git_info()
¶Get current git branch with error handling
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
print_header(text)
¶Print a dynamic header that adapts to screen size
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
print_info(message)
¶Print info message with consistent formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
332 333 334 | |
print_progress_bar(current, maximum, title='Progress')
¶Dynamic progress bar that adapts to screen size
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
print_section(title, content)
¶Print a clean section with adaptive formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
print_state(state, details=None)
¶Print current state with adaptive formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
print_success(message)
¶Print success message with consistent formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
324 325 326 | |
print_table(headers, rows)
¶Print a dynamic table that adapts to screen size
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
print_warning(message)
¶Print warning message with consistent formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
328 329 330 | |
process_with_spinner(message, coroutine)
async
¶Execute coroutine with adaptive spinner
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
EnhancedVerboseOutput
¶
Main interface for verbose output with full functionality
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | |
__getattr__(name)
¶Delegate to formatter for convenience
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
350 351 352 | |
clear_line()
¶Clear current line
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
537 538 539 | |
log_header(text)
¶Log header with timing information
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
418 419 420 421 422 423 424 425 426 | |
log_message(role, content)
async
¶Log chat messages with role-based formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
log_process_result(result)
async
¶Log processing results with structured formatting
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
log_state(state, user_ns=None, override=False)
¶Log state with optional override
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
428 429 430 431 432 433 | |
print_error(message)
¶Print an error message with red style
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
550 551 552 553 | |
print_event(event)
¶Print event information
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
print_separator(char='─')
¶Print a separator line
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
541 542 543 | |
print_success(message)
¶Print a success message with green style
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
555 556 557 558 | |
print_tool_call(tool_name, tool_args, result=None)
¶Gibt Informationen zum Tool-Aufruf aus. Versucht, das Ergebnis als JSON zu formatieren, wenn möglich.
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
print_warning(message)
¶Print a warning message with yellow style
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
545 546 547 548 | |
process(message, coroutine)
async
¶Process with optional spinner
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
435 436 437 438 439 440 441 442 443 | |
section_context(title)
¶Context manager for sections
Source code in toolboxv2/mods/isaa/extras/verbose_output.py
526 527 528 529 530 531 532 533 534 535 | |
web_search
¶
clean_markdown_robust(content)
¶
Robust markdown cleaning
Source code in toolboxv2/mods/isaa/extras/web_search.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
convert_to_markdown(element)
¶
Convert HTML element to markdown with fallbacks
Source code in toolboxv2/mods/isaa/extras/web_search.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
find_main_content(soup)
¶
Find main content using multiple strategies
Source code in toolboxv2/mods/isaa/extras/web_search.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
is_content_parseable(content)
¶
Check if content is properly parsed and readable
Source code in toolboxv2/mods/isaa/extras/web_search.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
is_mostly_readable(text)
¶
Check if text is mostly readable ASCII/common unicode
Source code in toolboxv2/mods/isaa/extras/web_search.py
320 321 322 323 324 325 326 | |
robust_search()
¶
Test the robust search functionality
Source code in toolboxv2/mods/isaa/extras/web_search.py
697 698 699 700 701 702 703 704 705 | |
url_to_markdown_robust(url)
¶
Robust URL to markdown converter with multiple encoding strategies
Source code in toolboxv2/mods/isaa/extras/web_search.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
web_search(query, max_results=5)
¶
Führt eine aktuelle Websuche über Perplexity (OpenRouter) aus. Robuste Fallbacks, komprimierte Antwort, heutiges Datum.
Source code in toolboxv2/mods/isaa/extras/web_search.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
web_search_bing(query, max_results=5, api_key=None)
¶
Web search using Bing Search API (free tier: 3,000 queries/month) Get your free API key at: https://azure.microsoft.com/en-us/services/cognitive-services/bing-web-search-api/
Source code in toolboxv2/mods/isaa/extras/web_search.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
web_search_robust(query, max_results=5, max_attempts=15)
¶
Robust search that keeps trying until it gets enough good results
Source code in toolboxv2/mods/isaa/extras/web_search.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | |
web_search_serpapi(query, max_results=5, api_key=None)
¶
Web search using SerpAPI (free tier: 100 searches/month) Get your free API key at: https://serpapi.com/
Source code in toolboxv2/mods/isaa/extras/web_search.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
kernel
¶
AgentIntegrationLayer
¶
Provides exported functions for the agent to interact with kernel
Source code in toolboxv2/mods/isaa/kernel/models.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | |
ask_user(question, timeout=300.0)
async
¶
Ask user a question and wait for response
Example
answer = await ask_user( "Which option do you prefer: A or B?", timeout=60.0 )
Source code in toolboxv2/mods/isaa/kernel/models.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | |
get_user_preferences()
async
¶
Get current user's learned preferences
Example
prefs = await get_user_preferences() style = prefs.get('communication_style')
Source code in toolboxv2/mods/isaa/kernel/models.py
983 984 985 986 987 988 989 990 991 992 993 | |
inject_memory(content, memory_type='fact', importance=0.5, tags=None)
async
¶
Inject a memory for current user
Example
memory_id = await inject_memory( "User prefers concise responses", memory_type="preference", importance=0.8 )
Source code in toolboxv2/mods/isaa/kernel/models.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | |
record_feedback(feedback, score)
async
¶
Record feedback for learning
Example
await record_feedback("Response was too long", -0.5)
Source code in toolboxv2/mods/isaa/kernel/models.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | |
schedule_task(task_type, content, delay_seconds=None, scheduled_time=None, priority=5)
async
¶
Schedule a task (callable by agent)
Example
task_id = await schedule_task( "reminder", "Follow up on project X", delay_seconds=3600 )
Source code in toolboxv2/mods/isaa/kernel/models.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | |
send_intermediate_response(content, stage='processing')
async
¶
Send intermediate response while processing
Example
await send_intermediate_response( "Analyzing data...", stage="analysis" )
Source code in toolboxv2/mods/isaa/kernel/models.py
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
ConsoleOutputRouter
¶
Bases: IOutputRouter
Simple console-based output router for testing
Source code in toolboxv2/mods/isaa/kernel/types.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶
Send notification to console
Source code in toolboxv2/mods/isaa/kernel/types.py
521 522 523 524 525 526 527 528 529 530 531 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶
Send response to console
Source code in toolboxv2/mods/isaa/kernel/types.py
510 511 512 513 514 515 516 517 518 519 | |
ContextStore
¶
Speichert System-Events und deren Ergebnisse für den Agent-Kontext
Source code in toolboxv2/mods/isaa/kernel/models.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
clear_old_events(max_age_seconds=3600)
¶
Clear events older than max_age
Source code in toolboxv2/mods/isaa/kernel/models.py
70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_event(event_id)
¶
Get an event result
Source code in toolboxv2/mods/isaa/kernel/models.py
54 55 56 57 58 59 | |
get_recent_events(limit=10)
¶
Get recent events sorted by timestamp
Source code in toolboxv2/mods/isaa/kernel/models.py
61 62 63 64 65 66 67 68 | |
store_event(event_id, data)
¶
Store an event result
Source code in toolboxv2/mods/isaa/kernel/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
DiscordKernelTools
¶
Discord-specific tools for kernel integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | |
add_reaction(channel_id, message_id, emoji)
async
¶
Add a reaction to a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to react to |
required |
emoji
|
str
|
Emoji to add (unicode or custom emoji name) |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
add_role(guild_id, user_id, role_id, reason=None)
async
¶
Add a role to a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
role_id
|
int
|
Role ID to add |
required |
reason
|
Optional[str]
|
Optional reason for audit log |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | |
ban_member(guild_id, user_id, reason=None, delete_message_days=0)
async
¶
Ban a member from the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to ban |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
delete_message_days
|
int
|
Days of messages to delete (0-7) |
0
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | |
can_hear_user(guild_id, user_id)
async
¶
Check if the bot can hear a specific user (voice listening status).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to check |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with hearing status and details |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | |
change_nickname(guild_id, user_id, nickname, reason=None)
async
¶
Change a member's nickname.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
nickname
|
Optional[str]
|
New nickname (None to remove) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 | |
create_announcement_template(template_name='announcement', title='📢 Announcement', description='{message}', color=16750848, mention_role=None)
async
¶
Create an announcement message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'announcement'
|
title
|
str
|
Announcement title |
'📢 Announcement'
|
description
|
str
|
Description with {message} variable |
'{message}'
|
color
|
int
|
Embed color |
16750848
|
mention_role
|
Optional[str]
|
Role mention (e.g., "@everyone", "@here") |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 | |
create_button_template(template_name, content=None, buttons=None)
async
¶
Create a message template with buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
content
|
Optional[str]
|
Message content |
None
|
buttons
|
Optional[List[Dict[str, Any]]]
|
List of button configs with keys: - label: Button text - style: "primary"/"secondary"/"success"/"danger"/"link" - custom_id: Unique ID for the button - emoji: Optional emoji - url: URL for link buttons - disabled: Boolean |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | |
create_channel(guild_id, name, channel_type='text', category_id=None, topic=None, slowmode_delay=0, nsfw=False)
async
¶
Create a new channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
name
|
str
|
Channel name |
required |
channel_type
|
str
|
'text', 'voice', 'category', 'stage' |
'text'
|
category_id
|
Optional[int]
|
Parent category ID |
None
|
topic
|
Optional[str]
|
Channel topic (text channels) |
None
|
slowmode_delay
|
int
|
Slowmode in seconds |
0
|
nsfw
|
bool
|
NSFW flag |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with channel info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | |
create_embed_template(template_name, title=None, description=None, color=3447003, fields=None, footer=None, author=None, thumbnail=None, image=None, url=None)
async
¶
Create a custom embed template with all options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
title
|
Optional[str]
|
Embed title (supports variables) |
None
|
description
|
Optional[str]
|
Embed description (supports variables) |
None
|
color
|
int
|
Color as hex integer |
3447003
|
fields
|
Optional[List[Dict[str, Any]]]
|
List of {"name": str, "value": str, "inline": bool} |
None
|
footer
|
Optional[str]
|
Footer text |
None
|
author
|
Optional[str]
|
Author name |
None
|
thumbnail
|
Optional[str]
|
Thumbnail URL |
None
|
image
|
Optional[str]
|
Image URL |
None
|
url
|
Optional[str]
|
Title URL |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 | |
create_invite(channel_id, max_age=86400, max_uses=0, temporary=False, unique=True, reason=None)
async
¶
Create an invitation link for a channel/server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to create invite for |
required |
max_age
|
int
|
Time in seconds until invite expires (0 = never, default 86400 = 24h) |
86400
|
max_uses
|
int
|
Max number of uses (0 = unlimited) |
0
|
temporary
|
bool
|
Whether members get temporary membership |
False
|
unique
|
bool
|
Create a unique invite (if False, may return existing similar invite) |
True
|
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with invite code, URL, and settings |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | |
create_message_template(template_name, content=None, embed=None, components=None)
async
¶
Create a reusable message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Unique name for the template |
required |
content
|
Optional[str]
|
Message text content |
None
|
embed
|
Optional[Dict[str, Any]]
|
Embed configuration dict |
None
|
components
|
Optional[List[Dict[str, Any]]]
|
List of components (buttons, select menus) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 | |
create_poll_template(template_name='poll', question='{question}', options=None)
async
¶
Create a poll template with reaction options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'poll'
|
question
|
str
|
Poll question with variables |
'{question}'
|
options
|
Optional[List[str]]
|
List of poll options (max 10) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 | |
create_select_menu_template(template_name, content=None, placeholder='Select an option', options=None, min_values=1, max_values=1)
async
¶
Create a message template with a select menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
content
|
Optional[str]
|
Message content |
None
|
placeholder
|
str
|
Placeholder text |
'Select an option'
|
options
|
Optional[List[Dict[str, Any]]]
|
List of option configs with keys: - label: Option label - value: Option value - description: Optional description - emoji: Optional emoji |
None
|
min_values
|
int
|
Minimum selections |
1
|
max_values
|
int
|
Maximum selections |
1
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 | |
create_server(name, icon=None, region=None)
async
¶
Create a new Discord server (guild).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Server name |
required |
icon
|
Optional[str]
|
Optional base64 encoded icon |
None
|
region
|
Optional[str]
|
Optional voice region |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with server info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | |
create_thread(channel_id, name, message_id=None, auto_archive_duration=1440)
async
¶
Create a thread in a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
str
|
Thread name |
required |
message_id
|
Optional[int]
|
Message to create thread from (optional) |
None
|
auto_archive_duration
|
int
|
Auto-archive in minutes (60, 1440, 4320, 10080) |
1440
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with thread info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | |
create_webhook(channel_id, name, avatar=None)
async
¶
Create a webhook.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
str
|
Webhook name |
required |
avatar
|
Optional[bytes]
|
Optional avatar bytes |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with webhook info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | |
create_welcome_template(template_name='welcome', title='Welcome to {server_name}!', description="Hey {username}, welcome to our server! We're glad to have you here.", color=65280, thumbnail=None, image=None, fields=None)
async
¶
Create a welcome message template with common variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'welcome'
|
title
|
str
|
Title with variables like {username}, {server_name}, {member_count} |
'Welcome to {server_name}!'
|
description
|
str
|
Description text with variables |
"Hey {username}, welcome to our server! We're glad to have you here."
|
color
|
int
|
Embed color (hex) |
65280
|
thumbnail
|
Optional[str]
|
Thumbnail URL |
None
|
image
|
Optional[str]
|
Image URL |
None
|
fields
|
Optional[List[Dict[str, Any]]]
|
List of embed fields |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 | |
delete_channel(channel_id, reason=None)
async
¶
Delete a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | |
delete_invite(invite_code, reason=None)
async
¶
Delete/revoke an invite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invite_code
|
str
|
Invite code (not full URL, just the code part) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | |
delete_message(channel_id, message_id, delay=0)
async
¶
Delete a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to delete |
required |
delay
|
float
|
Optional delay in seconds before deletion |
0
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
delete_message_template(template_name)
async
¶
Delete a message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 | |
delete_server(guild_id)
async
¶
Delete a Discord server (only if bot is owner).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to delete |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | |
disconnect_member(guild_id, user_id)
async
¶
Disconnect member from voice channel.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | |
edit_channel(channel_id, name=None, topic=None, slowmode_delay=None, nsfw=None, position=None)
async
¶
Edit channel settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
Optional[str]
|
New name |
None
|
topic
|
Optional[str]
|
New topic |
None
|
slowmode_delay
|
Optional[int]
|
Slowmode seconds |
None
|
nsfw
|
Optional[bool]
|
NSFW flag |
None
|
position
|
Optional[int]
|
Channel position |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | |
edit_message(channel_id, message_id, new_content=None, new_embed=None)
async
¶
Edit an existing message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to edit |
required |
new_content
|
Optional[str]
|
New message content (optional) |
None
|
new_embed
|
Optional[Dict[str, Any]]
|
New embed dict (optional) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and edited message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
edit_server(guild_id, name=None, icon=None, description=None, verification_level=None)
async
¶
Edit server settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
name
|
Optional[str]
|
New server name |
None
|
icon
|
Optional[str]
|
New icon (base64) |
None
|
description
|
Optional[str]
|
New description |
None
|
verification_level
|
Optional[int]
|
Verification level (0-4) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
export_to_agent()
async
¶
Export all Discord tools to the agent with categories and flags
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | |
get_bot_status()
async
¶
Get current bot status and statistics.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with bot status information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | |
get_channel_info(channel_id)
async
¶
Get information about a Discord channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with channel information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_invite_info(invite_code)
async
¶
Get information about an invite without joining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invite_code
|
str
|
Invite code |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with invite information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | |
get_invites(guild_id)
async
¶
Get all invites for a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of invite info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 | |
get_kernel_metrics()
async
¶
Get kernel performance metrics.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with kernel metrics |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | |
get_member_roles(guild_id, user_id)
async
¶
Get all roles of a member in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of role info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | |
get_message(channel_id, message_id)
async
¶
Get information about a specific message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to fetch |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with message information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
get_message_reactions(channel_id, message_id, emoji=None)
async
¶
Get reactions from a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where the message is |
required |
message_id
|
int
|
Message ID |
required |
emoji
|
Optional[str]
|
Optional specific emoji to get reactions for (e.g., "👍", "custom_emoji_name") |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with reaction data |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
get_message_template(template_name)
async
¶
Get a message template by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template data |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | |
get_recent_messages(channel_id, limit=10, before=None, after=None)
async
¶
Get recent messages from a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to fetch messages from |
required |
limit
|
int
|
Maximum number of messages to fetch (default 10, max 100) |
10
|
before
|
Optional[int]
|
Fetch messages before this message ID |
None
|
after
|
Optional[int]
|
Fetch messages after this message ID |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of message info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
get_server_info(guild_id=None)
async
¶
Get information about a Discord server (guild).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
Optional[int]
|
Optional guild ID. If None, returns info for all guilds. |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with server information including name, member count, channels, roles, etc. |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
get_template_examples()
async
¶
Get practical template examples for common scenarios.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with ready-to-use template examples showing tool usage |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 | |
get_template_help()
async
¶
Get comprehensive help on creating and using message templates.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with detailed template documentation and examples |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 | |
get_tools_overview()
async
¶
Get overview of all available Discord tools organized by category.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with categorized tool information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 | |
get_user_info(user_id, guild_id=None)
async
¶
Get information about a Discord user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
User ID |
required |
guild_id
|
Optional[int]
|
Optional guild ID for member-specific info |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with user information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
get_voice_status(guild_id)
async
¶
Get voice connection status for a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to check |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with voice status information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
join_thread(thread_id)
async
¶
Join a thread.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | |
join_voice_channel(channel_id)
async
¶
Join a voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Voice channel ID to join |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and voice client info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
kick_member(guild_id, user_id, reason=None)
async
¶
Kick a member from the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to kick |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | |
leave_thread(thread_id)
async
¶
Leave a thread.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 | |
leave_voice_channel(guild_id)
async
¶
Leave the current voice channel in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to leave voice channel from |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
list_channels(guild_id, channel_type=None)
async
¶
List all channels in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
channel_type
|
Optional[str]
|
Optional filter by type ('text', 'voice', 'category', 'stage') |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of channel info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
list_message_templates()
async
¶
List all available message templates.
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of template names and info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | |
move_member(guild_id, user_id, channel_id)
async
¶
Move member to different voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
channel_id
|
int
|
Target voice channel ID |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 | |
remove_reaction(channel_id, message_id, emoji, user_id=None)
async
¶
Remove a reaction from a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to remove reaction from |
required |
emoji
|
str
|
Emoji to remove |
required |
user_id
|
Optional[int]
|
Optional user ID (if None, removes bot's reaction) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
remove_role(guild_id, user_id, role_id, reason=None)
async
¶
Remove a role from a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
role_id
|
int
|
Role ID to remove |
required |
reason
|
Optional[str]
|
Optional reason for audit log |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
remove_timeout(guild_id, user_id, reason=None)
async
¶
Remove timeout from member.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | |
send_dm(user_id, content, embed=None)
async
¶
Send a DM to a user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
User ID |
required |
content
|
str
|
Message content |
required |
embed
|
Optional[Dict[str, Any]]
|
Optional embed dict |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 | |
send_file(channel_id, file_path, filename=None, content=None)
async
¶
Send a file to a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
file_path
|
str
|
Path to file |
required |
filename
|
Optional[str]
|
Optional filename override |
None
|
content
|
Optional[str]
|
Optional message content |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | |
send_message(channel_id, content, embed=None, reply_to=None)
async
¶
Send a message to a Discord channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to send message to |
required |
content
|
str
|
Message content (text) |
required |
embed
|
Optional[Dict[str, Any]]
|
Optional embed dict with title, description, color, fields |
None
|
reply_to
|
Optional[int]
|
Optional message ID to reply to |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with sent message info (id, channel_id, timestamp) |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
send_template_message(channel_id, template_name, variables=None, reply_to=None)
async
¶
Send a message using a template with variable substitution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to send to |
required |
template_name
|
str
|
Template name |
required |
variables
|
Optional[Dict[str, str]]
|
Dict of variables to substitute (e.g., {"username": "John", "points": "100"}) |
None
|
reply_to
|
Optional[int]
|
Optional message ID to reply to |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with sent message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | |
send_tts_message(guild_id, text, mode=None)
async
¶
Send a TTS (Text-to-Speech) message in the current voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID where the bot is in a voice channel |
required |
text
|
str
|
Text to speak via TTS |
required |
mode
|
Optional[str]
|
TTS mode ('elevenlabs' or 'piper', defaults to current mode) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and TTS info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
set_bot_status(status='online', activity_type='playing', activity_name=None)
async
¶
Set bot's Discord status and activity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
str
|
Status ('online', 'idle', 'dnd', 'invisible') |
'online'
|
activity_type
|
str
|
Activity type ('playing', 'watching', 'listening', 'streaming') |
'playing'
|
activity_name
|
Optional[str]
|
Activity name/text |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
set_channel_permissions(channel_id, target_id, target_type, allow=None, deny=None, reason=None)
async
¶
Set channel permissions for role or member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
target_id
|
int
|
Role or member ID |
required |
target_type
|
str
|
'role' or 'member' |
required |
allow
|
Optional[int]
|
Permissions to allow (bitfield) |
None
|
deny
|
Optional[int]
|
Permissions to deny (bitfield) |
None
|
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 | |
timeout_member(guild_id, user_id, duration_minutes, reason=None)
async
¶
Timeout (mute) a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
duration_minutes
|
int
|
Timeout duration in minutes (max 40320 = 28 days) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | |
toggle_tts(guild_id, mode=None)
async
¶
Toggle TTS (Text-to-Speech) on/off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
mode
|
Optional[str]
|
TTS mode ('elevenlabs', 'piper', 'off', or None to toggle) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with TTS status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | |
unban_member(guild_id, user_id, reason=None)
async
¶
Unban a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to unban |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | |
IDecisionEngine
¶
Bases: ABC
Abstract interface for proactivity decision making
Source code in toolboxv2/mods/isaa/kernel/types.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
evaluate_proactivity(context)
abstractmethod
async
¶
Decide if and how to handle a signal proactively
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProactivityContext
|
Context containing signal, user state, and history |
required |
Returns:
| Type | Description |
|---|---|
ProactivityDecision
|
ProactivityDecision indicating how to handle the signal |
Source code in toolboxv2/mods/isaa/kernel/types.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
should_interrupt_user(signal, user_state)
abstractmethod
async
¶
Quick check if user should be interrupted
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Signal
|
The signal to potentially interrupt with |
required |
user_state
|
UserState
|
Current user state |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if interruption is warranted |
Source code in toolboxv2/mods/isaa/kernel/types.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
IOutputRouter
¶
Bases: ABC
Abstract interface for routing agent outputs
Source code in toolboxv2/mods/isaa/kernel/types.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
send_notification(user_id, content, priority=5, metadata=None)
abstractmethod
async
¶
Send a proactive notification
Source code in toolboxv2/mods/isaa/kernel/types.py
495 496 497 498 499 500 501 502 503 504 | |
send_response(user_id, content, role='assistant', metadata=None)
abstractmethod
async
¶
Send a response to the user
Source code in toolboxv2/mods/isaa/kernel/types.py
484 485 486 487 488 489 490 491 492 493 | |
IProAKernel
¶
Bases: ABC
Abstract interface for the ProA Kernel
The kernel wraps the FlowAgent and provides: - Event-driven architecture - Proactive capabilities - User state awareness - Signal prioritization - Always-on lifecycle
Source code in toolboxv2/mods/isaa/kernel/types.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
get_status()
abstractmethod
¶
Get kernel status and metrics
Source code in toolboxv2/mods/isaa/kernel/types.py
461 462 463 464 | |
handle_user_input(user_id, content, metadata=None)
abstractmethod
async
¶
Handle direct user input
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
User identifier |
required |
content
|
str
|
User's input text |
required |
metadata
|
dict
|
Optional metadata (voice flags, etc.) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Agent's response |
Source code in toolboxv2/mods/isaa/kernel/types.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
set_do_not_disturb(user_id, enabled)
abstractmethod
async
¶
Enable/disable do-not-disturb mode
Source code in toolboxv2/mods/isaa/kernel/types.py
456 457 458 459 | |
set_user_location(user_id, location)
abstractmethod
async
¶
Update user's interface location (web, mobile, etc.)
Source code in toolboxv2/mods/isaa/kernel/types.py
451 452 453 454 | |
start()
abstractmethod
async
¶
Start the kernel lifecycle loop
Source code in toolboxv2/mods/isaa/kernel/types.py
402 403 404 405 | |
stop()
abstractmethod
async
¶
Stop the kernel gracefully
Source code in toolboxv2/mods/isaa/kernel/types.py
407 408 409 410 | |
trigger_event(event_name, payload, priority=5, source='external')
abstractmethod
async
¶
Trigger a system event
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_name
|
str
|
Name of the event |
required |
payload
|
dict
|
Event data |
required |
priority
|
int
|
Event priority (0-10) |
5
|
source
|
str
|
Event source identifier |
'external'
|
Source code in toolboxv2/mods/isaa/kernel/types.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
ISignalBus
¶
Bases: ABC
Abstract interface for signal ingestion and routing
Source code in toolboxv2/mods/isaa/kernel/types.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
emit_signal(signal)
abstractmethod
async
¶
Emit a signal into the kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
306 307 308 309 | |
get_next_signal(timeout=None)
abstractmethod
async
¶
Get next prioritized signal
Source code in toolboxv2/mods/isaa/kernel/types.py
311 312 313 314 | |
get_queue_size()
abstractmethod
¶
Get current queue size
Source code in toolboxv2/mods/isaa/kernel/types.py
316 317 318 319 | |
IStateMonitor
¶
Bases: ABC
Abstract interface for monitoring user and system state
Source code in toolboxv2/mods/isaa/kernel/types.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
get_user_state(user_id)
abstractmethod
async
¶
Get current user state
Source code in toolboxv2/mods/isaa/kernel/types.py
233 234 235 236 | |
set_do_not_disturb(user_id, enabled)
abstractmethod
async
¶
Set do-not-disturb mode
Source code in toolboxv2/mods/isaa/kernel/types.py
252 253 254 255 | |
set_user_location(user_id, location)
abstractmethod
async
¶
Update user's current interface location
Source code in toolboxv2/mods/isaa/kernel/types.py
247 248 249 250 | |
update_user_activity(user_id, activity='input')
abstractmethod
async
¶
Record user activity
Source code in toolboxv2/mods/isaa/kernel/types.py
238 239 240 241 242 243 244 245 | |
InteractionType
¶
Bases: Enum
Types of interactions to learn from
Source code in toolboxv2/mods/isaa/kernel/types.py
584 585 586 587 588 589 590 591 | |
Kernel
¶
Bases: IProAKernel
Autonomous event-driven kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
get_status()
¶
Get kernel status.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | |
handle_user_input(user_id, content, metadata=None)
async
¶
Handle user input.
Source code in toolboxv2/mods/isaa/kernel/instace.py
987 988 989 990 991 992 993 994 995 996 997 998 | |
load_from_file(filepath)
async
¶
Load kernel state.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | |
save_to_file(filepath=None)
async
¶
Save kernel state.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | |
start()
async
¶
Start kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
615 616 617 618 619 620 621 622 623 624 625 626 627 | |
stop()
async
¶
Stop kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
trigger_event(event_name, payload, priority=5, source='external')
async
¶
Trigger system event.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | |
KernelConfig
dataclass
¶
Configuration for ProA Kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
KernelMetrics
dataclass
¶
Metrics for kernel operation
Source code in toolboxv2/mods/isaa/kernel/types.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
get_uptime()
¶
Get kernel uptime in seconds
Source code in toolboxv2/mods/isaa/kernel/types.py
554 555 556 | |
to_dict()
¶
Convert to dictionary
Source code in toolboxv2/mods/isaa/kernel/types.py
558 559 560 561 562 563 564 565 566 567 568 | |
update_response_time(response_time)
¶
Update average response time
Source code in toolboxv2/mods/isaa/kernel/types.py
547 548 549 550 551 552 | |
KernelState
¶
Bases: Enum
Possible kernel states
Source code in toolboxv2/mods/isaa/kernel/types.py
469 470 471 472 473 474 475 476 | |
LearningEngine
¶
Learning system that analyzes interactions and adapts behavior
Source code in toolboxv2/mods/isaa/kernel/models.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
analyze_and_learn(user_id)
async
¶
Analyze interactions and update preferences
Source code in toolboxv2/mods/isaa/kernel/models.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
apply_preferences_to_query(user_id, query)
async
¶
Apply learned preferences to modify query or execution
Returns:
| Type | Description |
|---|---|
tuple[str, dict]
|
(modified_query, execution_hints) |
Source code in toolboxv2/mods/isaa/kernel/models.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
get_preferences(user_id)
¶
Get user preferences
Source code in toolboxv2/mods/isaa/kernel/models.py
262 263 264 265 266 | |
record_interaction(user_id, interaction_type, content, context=None, outcome=None, feedback_score=None)
async
¶
Record an interaction for learning
Source code in toolboxv2/mods/isaa/kernel/models.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
LearningRecord
¶
Bases: BaseModel
Pydantic model for learning records
Source code in toolboxv2/mods/isaa/kernel/types.py
594 595 596 597 598 599 600 601 602 603 | |
Memory
¶
Bases: BaseModel
Individual memory item
Source code in toolboxv2/mods/isaa/kernel/types.py
632 633 634 635 636 637 638 639 640 641 642 643 | |
MemoryStore
¶
Advanced memory system for injecting context
Source code in toolboxv2/mods/isaa/kernel/models.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
format_memories_for_context(memories)
¶
Format memories for LLM context
Source code in toolboxv2/mods/isaa/kernel/models.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
get_relevant_memories(user_id, query=None, limit=10, min_importance=0.3)
async
¶
Get relevant memories for context
Source code in toolboxv2/mods/isaa/kernel/models.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
inject_memory(user_id, memory_type, content, metadata=None, importance=0.5, tags=None)
async
¶
Inject a new memory
Source code in toolboxv2/mods/isaa/kernel/models.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
MemoryType
¶
Bases: Enum
Types of memories
Source code in toolboxv2/mods/isaa/kernel/types.py
623 624 625 626 627 628 629 | |
MultiChannelRouter
¶
Bases: IOutputRouter
Route to multiple channels (console, websocket, etc.)
Source code in toolboxv2/mods/isaa/kernel/models.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | |
add_router(router)
¶
Add a router
Source code in toolboxv2/mods/isaa/kernel/models.py
814 815 816 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶
Send notification via all routers
Source code in toolboxv2/mods/isaa/kernel/models.py
832 833 834 835 836 837 838 839 840 841 842 843 844 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶
Send via all routers
Source code in toolboxv2/mods/isaa/kernel/models.py
818 819 820 821 822 823 824 825 826 827 828 829 830 | |
ProactiveActionTracker
¶
Tracks proactive actions to enforce rate limits
Source code in toolboxv2/mods/isaa/kernel/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
get_recent_count(window_seconds=3600)
¶
Get count of recent proactive actions
Source code in toolboxv2/mods/isaa/kernel/models.py
104 105 106 107 108 | |
get_time_since_last()
¶
Get seconds since last proactive action
Source code in toolboxv2/mods/isaa/kernel/models.py
110 111 112 113 114 | |
record_action(action_type='notification')
¶
Record a proactive action
Source code in toolboxv2/mods/isaa/kernel/models.py
94 95 96 97 98 99 100 101 102 | |
ProactivityContext
dataclass
¶
Context for making proactivity decisions
Source code in toolboxv2/mods/isaa/kernel/types.py
100 101 102 103 104 105 106 107 | |
ProactivityDecision
¶
Bases: Enum
Possible proactivity decisions
Source code in toolboxv2/mods/isaa/kernel/types.py
110 111 112 113 114 115 | |
ScheduledTask
¶
Bases: BaseModel
Model for scheduled tasks
Source code in toolboxv2/mods/isaa/kernel/types.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
Signal
dataclass
¶
Unified signal structure for all kernel inputs
Source code in toolboxv2/mods/isaa/kernel/types.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
__lt__(other)
¶
Enable priority queue sorting (higher priority first)
Source code in toolboxv2/mods/isaa/kernel/types.py
45 46 47 | |
SignalType
¶
Bases: Enum
Types of signals that can be processed by the kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
23 24 25 26 27 28 29 30 31 | |
TaskScheduler
¶
Advanced task scheduler for user and agent tasks
Source code in toolboxv2/mods/isaa/kernel/models.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
cancel_task(task_id)
async
¶
Cancel a scheduled task
Source code in toolboxv2/mods/isaa/kernel/models.py
533 534 535 536 537 538 539 540 | |
get_user_tasks(user_id, status=None)
¶
Get tasks for a user
Source code in toolboxv2/mods/isaa/kernel/models.py
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
schedule_task(user_id, task_type, content, scheduled_time=None, delay_seconds=None, priority=5, recurrence=None, metadata=None)
async
¶
Schedule a task for execution with validation
Source code in toolboxv2/mods/isaa/kernel/models.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
start()
async
¶
Start the scheduler
Source code in toolboxv2/mods/isaa/kernel/models.py
460 461 462 463 464 | |
stop()
async
¶
Stop the scheduler
Source code in toolboxv2/mods/isaa/kernel/models.py
466 467 468 469 470 471 472 473 474 475 | |
TaskStatus
¶
Bases: Enum
Status of scheduled tasks
Source code in toolboxv2/mods/isaa/kernel/types.py
648 649 650 651 652 653 654 | |
UserContext
dataclass
¶
Track user state and context
Source code in toolboxv2/mods/isaa/kernel/types.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
get_idle_time()
¶
Get seconds since last interaction
Source code in toolboxv2/mods/isaa/kernel/types.py
80 81 82 | |
update_interaction(activity='input')
¶
Record user interaction
Source code in toolboxv2/mods/isaa/kernel/types.py
70 71 72 73 74 75 76 77 78 | |
update_state()
¶
Update state based on idle time
Source code in toolboxv2/mods/isaa/kernel/types.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
UserPreferences
¶
Bases: BaseModel
Learned user preferences
Source code in toolboxv2/mods/isaa/kernel/types.py
606 607 608 609 610 611 612 613 614 615 616 617 | |
UserState
¶
Bases: Enum
Possible states of user engagement
Source code in toolboxv2/mods/isaa/kernel/types.py
52 53 54 55 56 57 | |
WebSocketOutputRouter
¶
Bases: IOutputRouter
WebSocket-based output router
Source code in toolboxv2/mods/isaa/kernel/models.py
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
register_connection(user_id, websocket)
¶
Register a WebSocket connection
Source code in toolboxv2/mods/isaa/kernel/models.py
695 696 697 698 699 | |
send_intermediate_response(user_id, content, stage='processing')
async
¶
Send intermediate status update
Source code in toolboxv2/mods/isaa/kernel/models.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶
Send notification via WebSocket with fallback
Source code in toolboxv2/mods/isaa/kernel/models.py
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶
Send response via WebSocket
Source code in toolboxv2/mods/isaa/kernel/models.py
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
unregister_connection(user_id)
¶
Unregister a WebSocket connection
Source code in toolboxv2/mods/isaa/kernel/models.py
718 719 720 721 722 | |
WhatsAppKernelTools
¶
WhatsApp-spezifische Tools für die Agenten-Integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
add_to_broadcast(list_name, user_id)
async
¶
Fügt User zur Liste hinzu
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
117 118 119 120 121 122 123 124 125 | |
create_broadcast_list(name, user_ids)
async
¶
Erstellt eine neue Broadcast-Liste (Simulierte Gruppe)
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
112 113 114 115 | |
export_to_agent()
async
¶
Exportiert die Tools zum Agenten
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
mark_as_read(message_id)
async
¶
Markiert eine Nachricht explizit als gelesen
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
164 165 166 167 168 169 170 | |
send_broadcast(list_name, content, is_interactive=False)
async
¶
Sendet eine Nachricht an alle in der Liste.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
send_buttons(user_id, text, buttons, header=None, footer=None)
async
¶
Sendet eine Nachricht mit bis zu 3 Buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Telefonnummer des Empfängers |
required |
text
|
str
|
Nachrichtentext |
required |
buttons
|
List[Dict[str, str]]
|
Liste von Dictionaries [{"id": "yes_btn", "title": "Ja"}, ...] |
required |
header
|
Optional[str]
|
Optionaler Header-Text |
None
|
footer
|
Optional[str]
|
Optionaler Footer-Text |
None
|
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
send_contact(user_id, contact_name, contact_phone)
async
¶
Sendet eine vCard / Kontaktkarte
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
151 152 153 154 155 156 157 158 159 160 161 162 | |
send_menu_list(user_id, text, button_text, sections, title='Menü')
async
¶
Sendet ein Listen-Menü (bis zu 10 Optionen).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sections
|
List[Dict[str, Any]]
|
Liste von Sektionen [{"title": "Sektion 1", "rows": [{"id": "1", "title": "Option A", "description": "Details"}]}] |
required |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
instace
¶
ProA Kernel - Autonomous Event-Driven System Version: 2.1.0
Architecture: - Perception Layer: Event → PerceivedEvent (RuleSet.get_groups_for_intent) - World Model: User + Environment State (SessionManager.sessions) - Attention System: Salience Scoring (RuleSet.match_rules) - Decision Engine: Act/Schedule/Queue/Observe (RuleSet.rule_on_action) - Learning Loop: Pattern Detection (RuleSet.learn_pattern, add_rule)
Uses FlowAgent + SessionManager + RuleSet - no duplication.
ActionPlan
dataclass
¶
What to do and how.
Source code in toolboxv2/mods/isaa/kernel/instace.py
345 346 347 348 349 350 351 352 353 354 355 | |
ActionType
¶
Bases: Enum
How to act.
Source code in toolboxv2/mods/isaa/kernel/instace.py
336 337 338 339 340 341 342 | |
AttentionSystem
¶
Determines event importance using RuleSet.
Source code in toolboxv2/mods/isaa/kernel/instace.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
compute_salience(event, user_model, session)
¶Compute salience score.
Source code in toolboxv2/mods/isaa/kernel/instace.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
AutonomousDecision
¶
Bases: Enum
Kernel decision types.
Source code in toolboxv2/mods/isaa/kernel/instace.py
327 328 329 330 331 332 333 | |
AutonomousDecisionEngine
¶
Decision engine using RuleSet.
Source code in toolboxv2/mods/isaa/kernel/instace.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
decide(event, salience, user_model, session)
async
¶Decide what to do.
Source code in toolboxv2/mods/isaa/kernel/instace.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
InteractionOutcome
dataclass
¶
Outcome of an action for learning.
Source code in toolboxv2/mods/isaa/kernel/instace.py
437 438 439 440 441 442 443 444 445 | |
Kernel
¶
Bases: IProAKernel
Autonomous event-driven kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
get_status()
¶Get kernel status.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | |
handle_user_input(user_id, content, metadata=None)
async
¶Handle user input.
Source code in toolboxv2/mods/isaa/kernel/instace.py
987 988 989 990 991 992 993 994 995 996 997 998 | |
load_from_file(filepath)
async
¶Load kernel state.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | |
save_to_file(filepath=None)
async
¶Save kernel state.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | |
start()
async
¶Start kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
615 616 617 618 619 620 621 622 623 624 625 626 627 | |
stop()
async
¶Stop kernel.
Source code in toolboxv2/mods/isaa/kernel/instace.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
trigger_event(event_name, payload, priority=5, source='external')
async
¶Trigger system event.
Source code in toolboxv2/mods/isaa/kernel/instace.py
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | |
LearningLoop
¶
Learns from outcomes using RuleSet.
Source code in toolboxv2/mods/isaa/kernel/instace.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
record_outcome(outcome, session)
async
¶Record and learn from outcome.
Source code in toolboxv2/mods/isaa/kernel/instace.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
PerceivedEvent
dataclass
¶
Normalized event with extracted features.
Source code in toolboxv2/mods/isaa/kernel/instace.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
PerceptionLayer
¶
Transforms raw signals into perceived events using RuleSet.
Source code in toolboxv2/mods/isaa/kernel/instace.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
perceive(signal, session)
async
¶Extract features from signal using session's RuleSet.
Source code in toolboxv2/mods/isaa/kernel/instace.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
SalienceScore
dataclass
¶
How important is this event?
Source code in toolboxv2/mods/isaa/kernel/instace.py
264 265 266 267 268 269 | |
UserModel
dataclass
¶
Dynamic model of a user.
Source code in toolboxv2/mods/isaa/kernel/instace.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
is_likely_available()
¶Check if user is likely available based on rhythm.
Source code in toolboxv2/mods/isaa/kernel/instace.py
211 212 213 214 | |
update_activity(hour=None)
¶Update activity rhythm.
Source code in toolboxv2/mods/isaa/kernel/instace.py
203 204 205 206 207 208 209 | |
WorldModel
¶
Maintains world state from SessionManager.
Source code in toolboxv2/mods/isaa/kernel/instace.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
get_active_sessions()
¶Get active session IDs from SessionManager.
Source code in toolboxv2/mods/isaa/kernel/instace.py
231 232 233 | |
get_session_stats(user_id)
¶Get session statistics.
Source code in toolboxv2/mods/isaa/kernel/instace.py
235 236 237 238 239 240 | |
get_user(user_id)
¶Get or create user model.
Source code in toolboxv2/mods/isaa/kernel/instace.py
224 225 226 227 228 229 | |
update_from_event(event, success)
async
¶Update world model after interaction.
Source code in toolboxv2/mods/isaa/kernel/instace.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
kernelin
¶
kernelin_cli
¶
CLIOutputRouter
¶
Bases: IOutputRouter
Konkrete Implementierung des Routers für das Terminal. Leitet Antworten und Benachrichtigungen direkt an stdout weiter.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_cli.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Gibt proaktive Benachrichtigungen aus.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_cli.py
40 41 42 43 44 45 46 47 48 49 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Gibt die Antwort des Agenten farbig formatiert aus.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_cli.py
29 30 31 32 33 34 35 36 37 38 | |
ainput(prompt='')
async
¶Nicht-blockierender Input, damit der Kernel-Loop (Heartbeat) nicht stoppt, während auf User-Eingabe gewartet wird.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_cli.py
56 57 58 59 60 61 62 63 | |
kernelin_discord
¶
Discord Transport Layer for ProA Kernel Version: 1.0.0
A DUMB transport layer that: - Converts Discord events → Kernel Signals - Routes Kernel responses → Discord messages/voice - Contains NO business logic
Dependencies: discord.py, groq (for voice transcription)
DiscordConfig
dataclass
¶Discord transport configuration
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
DiscordOutputRouter
¶
Bases: IOutputRouter
Routes Kernel outputs to Discord
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
register_user_channel(user_id, channel_id, guild_id=None)
¶Register which channel a user last interacted in
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
302 303 304 305 306 | |
send_file(user_id, filepath, filename=None, content='')
async
¶Send file to user
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Send proactive notification
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Send response to user via Discord
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
set_voice_mode(user_id, enabled)
¶Set whether user prefers voice responses
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
308 309 310 | |
DiscordTransport
¶Discord Transport Layer for ProA Kernel
Responsibilities: 1. Convert Discord events → Kernel Signals 2. Route Kernel outputs → Discord 3. Handle voice channels and TTS 4. Manage media attachments
NO business logic - just transport!
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | |
get_router()
¶Get the output router for kernel integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
625 626 627 | |
start()
async
¶Start the Discord bot
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
610 611 612 613 | |
stop()
async
¶Stop the Discord bot
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
615 616 617 618 619 620 621 622 623 | |
MediaHandler
¶Handles media downloads and processing
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
cleanup_old_files(max_age_hours=24)
¶Clean up old temp files
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
129 130 131 132 133 134 135 136 137 | |
download_attachment(attachment)
async
¶Download attachment to temp file, return path
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
transcribe_audio(audio_path)
async
¶Transcribe audio file using Groq Whisper
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
VoiceHandler
¶Handles Discord voice channel interactions
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
get_connected_channel(guild_id)
¶Get currently connected voice channel for guild
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
189 190 191 192 193 194 | |
is_connected(guild_id)
¶Check if connected to voice in guild
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
196 197 198 199 | |
join_channel(channel)
async
¶Join a voice channel
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
leave_channel(guild_id)
async
¶Leave voice channel
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
183 184 185 186 187 | |
set_transcription_callback(callback)
¶Set callback for when audio is transcribed
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
161 162 163 | |
speak_text(guild_id, text)
async
¶Convert text to speech and play in voice channel
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
create_discord_transport(kernel, token, admin_ids, identity_map=None, **config_kwargs)
¶Factory function to create Discord transport.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
ProA Kernel instance |
required |
token
|
str
|
Discord bot token |
required |
admin_ids
|
list[int]
|
List of authorized Discord user IDs |
required |
identity_map
|
Optional[dict]
|
Optional mapping of discord IDs to unified user IDs |
None
|
**config_kwargs
|
Additional DiscordConfig options |
{}
|
Returns:
| Type | Description |
|---|---|
DiscordTransport
|
Configured DiscordTransport instance |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
run_discord_standalone(kernel, token, admin_ids)
async
¶Run Discord transport standalone (for testing)
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_discord.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
kernelin_telegram
¶
Telegram Transport Layer for ProA Kernel Version: 1.0.0
A DUMB transport layer that: - Converts Telegram updates → Kernel Signals - Routes Kernel responses → Telegram messages - Contains NO business logic
Dependencies: python-telegram-bot, groq (for voice transcription)
MarkdownV2Escaper
¶Handles MarkdownV2 escaping for Telegram.
MarkdownV2 requires escaping of special characters: _ * [ ] ( ) ~ ` > # + - = | { } . !
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
escape(text)
classmethod
¶Escape text for MarkdownV2
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
86 87 88 89 90 91 92 | |
escape_code(text)
classmethod
¶Escape text inside code blocks (only ` and )
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
94 95 96 97 98 99 | |
format_response(text)
classmethod
¶Format agent response for MarkdownV2. Preserves code blocks and escapes the rest.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
TelegramConfig
dataclass
¶Telegram transport configuration
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
TelegramMediaHandler
¶Handles media downloads and processing
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
cleanup_old_files(max_age_hours=24)
¶Clean up old temp files
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
242 243 244 245 246 247 248 249 250 | |
download_document(document)
async
¶Download document to temp file
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
download_photo(photo_file_id, filename_hint='')
async
¶Download photo to temp file
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
download_voice(voice_file_id)
async
¶Download voice message to temp file
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
transcribe_audio(audio_path)
async
¶Transcribe audio file using Groq Whisper
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
TelegramOutputRouter
¶
Bases: IOutputRouter
Routes Kernel outputs to Telegram
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
register_user_chat(user_id, chat_id)
¶Register user's chat ID
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
269 270 271 | |
send_file(user_id, filepath, caption='')
async
¶Send file to user
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Send proactive notification
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
send_photo(user_id, filepath, caption='')
async
¶Send photo to user
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Send response to user via Telegram
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
start_typing(chat_id)
async
¶Start typing indicator
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
TelegramTransport
¶Telegram Transport Layer for ProA Kernel
Responsibilities: 1. Convert Telegram updates → Kernel Signals 2. Route Kernel outputs → Telegram messages 3. Handle voice notes (transcription) 4. Handle photos and documents
NO business logic - just transport!
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | |
get_router()
¶Get the output router for kernel integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
745 746 747 | |
send_direct_message(chat_id, text)
async
¶Send a direct message to a chat (for proactive notifications from Kernel). This bypasses the output router for direct Kernel->Telegram communication.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
749 750 751 752 753 754 755 756 757 | |
start()
async
¶Start the Telegram bot
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
729 730 731 732 733 734 735 | |
stop()
async
¶Stop the Telegram bot
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
737 738 739 740 741 742 743 | |
create_telegram_transport(kernel, token, admin_ids, identity_map=None, **config_kwargs)
¶Factory function to create Telegram transport.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
ProA Kernel instance |
required |
token
|
str
|
Telegram bot token |
required |
admin_ids
|
list[int]
|
List of authorized Telegram user IDs |
required |
identity_map
|
Optional[dict]
|
Optional mapping of telegram IDs to unified user IDs |
None
|
**config_kwargs
|
Additional TelegramConfig options |
{}
|
Returns:
| Type | Description |
|---|---|
TelegramTransport
|
Configured TelegramTransport instance |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
run_telegram_standalone(kernel, token, admin_ids)
async
¶Run Telegram transport standalone (for testing)
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_telegram.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | |
kernelin_whatsapp
¶
ProA Kernel WhatsApp Interface¶
Production-ready WhatsApp interface for the Enhanced ProA Kernel with: - Auto-persistence (save/load on start/stop) - Full media support (images, documents, audio, video) - Message formatting (bold, italic, code) - Typing indicators - Read receipts - Contact management
WhatsAppKernel
¶Advanced WhatsApp Kernel mit Voice-Transkription und Gruppen-Logik
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | |
handle_webhook_payload(data)
async
¶Haupt-Eingangspunkt für Webhook-Daten von Meta/WhatsApp Cloud API. Muss vom Webserver (Flask/FastAPI) aufgerufen werden.
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | |
start()
async
¶Startet den Kernel
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
WhatsAppOutputRouter
¶
Bases: IOutputRouter
Erweiterter Output-Router mit Support für Interaktive Nachrichten & Medien
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | |
send_media(user_id, media_path, media_type='document', caption=None)
async
¶Sendet Medien
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
655 656 657 658 659 660 661 662 663 664 665 666 667 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Sendet eine Proactive Notification
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
646 647 648 649 650 651 652 653 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Sendet eine Antwort an den Nutzer (Text oder Interaktiv)
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | |
add_kernel_instance(app, instance_id, phone_number_id, token, auto_save_interval=300)
async
¶Add a new WhatsApp kernel instance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
App
|
ToolBoxV2 App instance |
required |
instance_id
|
str
|
Unique identifier for this instance |
required |
phone_number_id
|
str
|
WhatsApp Business phone number ID |
required |
token
|
str
|
WhatsApp API token |
required |
auto_save_interval
|
int
|
Auto-save interval in seconds |
300
|
Returns:
| Type | Description |
|---|---|
dict
|
dict with success status and info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
feed_webhook_data(data, instance_id='main')
async
¶Funktion, die vom Webserver aufgerufen wird, um Daten in den Kernel zu speisen
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
939 940 941 942 943 944 945 | |
get_kernel_status(instance_id)
async
¶Get status of a specific WhatsApp kernel instance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_id
|
str
|
Instance identifier |
required |
Returns:
| Type | Description |
|---|---|
dict
|
dict with kernel status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
init_kernel_whatsapp(app)
async
¶Initialize the WhatsApp Kernel module
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
list_kernel_instances()
¶List all active WhatsApp kernel instances
Returns:
| Type | Description |
|---|---|
dict
|
dict with list of instance IDs and their status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
on_exit_whatsapp()
async
¶Cleanup on module exit
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
348 349 350 351 352 353 354 355 356 357 | |
remove_kernel_instance(instance_id)
async
¶Remove a WhatsApp kernel instance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_id
|
str
|
Instance identifier to remove |
required |
Returns:
| Type | Description |
|---|---|
dict
|
dict with success status and info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/kernelin_whatsapp.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
obsidian
¶
Obsidian Module Init
FileChange
dataclass
¶Represents a file change
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
ObsidianMCPTools
¶MCP Tool definitions for Obsidian vault access
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | |
execute_tool(tool_name, parameters)
async
¶Execute an MCP tool
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | |
get_tools()
¶Get tool definitions for MCP/Agent registration
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | |
SyncService
¶Main sync service orchestrating real-time sync between clients and server.
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
generate_token(user_id, expires_hours=24)
¶Generate JWT token for client auth
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
598 599 600 601 602 603 604 605 606 607 608 | |
handle_client_change(client, change)
async
¶Handle change from client
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
handle_server_change(change)
async
¶Handle change from server (e.g., from agent)
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
start()
async
¶Start the sync service
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
stop()
async
¶Stop the sync service
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
346 347 348 349 350 351 352 353 354 355 356 357 358 | |
VaultManager
¶Manages Obsidian vault operations with persistent incremental indexing
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
append_to_daily(content, section='Notes', for_date=None, agent_id=None)
¶Append content to a section in daily note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
create_note(path, title, template=None, tags=None, agent_id=None)
¶Create a new note from template
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
delete_note(path, soft=True, agent_id=None)
¶Delete a note (soft = move to archive)
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
force_reindex()
¶Force complete reindex of vault
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
886 887 888 889 890 891 | |
get_backlinks(path)
¶Get all notes that link to this note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
648 649 650 | |
get_branch_status(agent_id)
¶Get status of agent's branch
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | |
get_daily_note(for_date=None)
¶Get or create daily note for date
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | |
get_graph()
¶Get full graph structure
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
get_index_stats()
¶Get index statistics
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 | |
get_neighbors(path, depth=1)
¶Get linked notes within N hops
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
get_orphans()
¶Get notes with no incoming or outgoing links
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
842 843 844 845 846 847 848 849 850 851 852 853 854 | |
merge_to_main(agent_id, auto=True)
¶Merge agent branch to main
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
read_note(path)
¶Read a note by path
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
541 542 543 544 545 546 547 548 549 550 551 552 | |
search_by_tag(tag)
¶Find all notes with a specific tag
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
634 635 636 637 638 639 640 641 642 643 644 645 646 | |
search_notes(query, limit=20)
¶Full-text search across all notes
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
suggest_links(path, limit=5)
¶Suggest potential links based on content similarity
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
write_note(path, content, frontmatter=None, agent_id=None)
¶Write or update a note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
mcp_server
¶Obsidian MCP Server for Agent Access¶
Provides MCP tools for agents to interact with Obsidian vaults: - Read/Write/Search notes - Graph operations (links, backlinks, neighbors) - Daily notes management - Git-based versioning per agent branch
Architecture: - Each agent works on its own branch (agent/discord, agent/telegram) - Changes auto-commit to agent branch - Auto-merge to main if no conflicts - Conflicts flagged for manual resolution
FileIndexEntry
dataclass
¶Index entry for a single file
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
FolderIndex
dataclass
¶Index for a single folder - enables granular updates
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
ObsidianMCPTools
¶MCP Tool definitions for Obsidian vault access
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | |
execute_tool(tool_name, parameters)
async
¶Execute an MCP tool
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | |
get_tools()
¶Get tool definitions for MCP/Agent registration
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | |
VaultIndex
dataclass
¶Complete vault index with folder-based sharding
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
VaultManager
¶Manages Obsidian vault operations with persistent incremental indexing
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
append_to_daily(content, section='Notes', for_date=None, agent_id=None)
¶Append content to a section in daily note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
create_note(path, title, template=None, tags=None, agent_id=None)
¶Create a new note from template
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
delete_note(path, soft=True, agent_id=None)
¶Delete a note (soft = move to archive)
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
force_reindex()
¶Force complete reindex of vault
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
886 887 888 889 890 891 | |
get_backlinks(path)
¶Get all notes that link to this note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
648 649 650 | |
get_branch_status(agent_id)
¶Get status of agent's branch
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | |
get_daily_note(for_date=None)
¶Get or create daily note for date
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | |
get_graph()
¶Get full graph structure
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
get_index_stats()
¶Get index statistics
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 | |
get_neighbors(path, depth=1)
¶Get linked notes within N hops
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
get_orphans()
¶Get notes with no incoming or outgoing links
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
842 843 844 845 846 847 848 849 850 851 852 853 854 | |
merge_to_main(agent_id, auto=True)
¶Merge agent branch to main
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
read_note(path)
¶Read a note by path
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
541 542 543 544 545 546 547 548 549 550 551 552 | |
search_by_tag(tag)
¶Find all notes with a specific tag
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
634 635 636 637 638 639 640 641 642 643 644 645 646 | |
search_notes(query, limit=20)
¶Full-text search across all notes
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
suggest_links(path, limit=5)
¶Suggest potential links based on content similarity
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
write_note(path, content, frontmatter=None, agent_id=None)
¶Write or update a note
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/mcp_server.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
sync_service
¶Obsidian Live Sync Service¶
Bidirectional real-time sync between: - Server (Source of Truth) - Desktop Obsidian App - Mobile Obsidian App - Web Viewer (read-only)
Uses WebSocket for real-time updates and Git for versioning.
Protocol: - Delta sync (only changes, not full files) - CRDT-based conflict resolution - JWT authentication - Per-client sync branches
ClientConnection
dataclass
¶Represents a connected client
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
137 138 139 140 141 142 143 144 145 146 147 | |
ConflictResolver
¶Handle sync conflicts
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
resolve(local_change, remote_change)
staticmethod
¶Resolve conflict between local and remote changes.
Strategy: - If same change type and similar timestamp: merge content - If different types: prioritize by type (delete < modify < create) - If timestamps differ significantly: latest wins
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
FileChange
dataclass
¶Represents a file change
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
SyncMessage
dataclass
¶WebSocket message format
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
SyncService
¶Main sync service orchestrating real-time sync between clients and server.
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
generate_token(user_id, expires_hours=24)
¶Generate JWT token for client auth
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
598 599 600 601 602 603 604 605 606 607 608 | |
handle_client_change(client, change)
async
¶Handle change from client
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
handle_server_change(change)
async
¶Handle change from server (e.g., from agent)
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
start()
async
¶Start the sync service
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
stop()
async
¶Stop the sync service
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
346 347 348 349 350 351 352 353 354 355 356 357 358 | |
VaultFileHandler
¶
Bases: FileSystemEventHandler
Watch vault for file changes
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
main()
async
¶Run sync service standalone
Source code in toolboxv2/mods/isaa/kernel/kernelin/obsidian/sync_service.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
tools
¶
discord_tools
¶Discord-Specific Tools for ProA Kernel Version: 1.0.0
Provides Discord-specific tools for server management, user management, voice control, and lifetime management that are exported to the agent.
DiscordKernelTools
¶Discord-specific tools for kernel integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | |
add_reaction(channel_id, message_id, emoji)
async
¶Add a reaction to a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to react to |
required |
emoji
|
str
|
Emoji to add (unicode or custom emoji name) |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
add_role(guild_id, user_id, role_id, reason=None)
async
¶Add a role to a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
role_id
|
int
|
Role ID to add |
required |
reason
|
Optional[str]
|
Optional reason for audit log |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | |
ban_member(guild_id, user_id, reason=None, delete_message_days=0)
async
¶Ban a member from the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to ban |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
delete_message_days
|
int
|
Days of messages to delete (0-7) |
0
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | |
can_hear_user(guild_id, user_id)
async
¶Check if the bot can hear a specific user (voice listening status).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to check |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with hearing status and details |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | |
change_nickname(guild_id, user_id, nickname, reason=None)
async
¶Change a member's nickname.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
nickname
|
Optional[str]
|
New nickname (None to remove) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 | |
create_announcement_template(template_name='announcement', title='📢 Announcement', description='{message}', color=16750848, mention_role=None)
async
¶Create an announcement message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'announcement'
|
title
|
str
|
Announcement title |
'📢 Announcement'
|
description
|
str
|
Description with {message} variable |
'{message}'
|
color
|
int
|
Embed color |
16750848
|
mention_role
|
Optional[str]
|
Role mention (e.g., "@everyone", "@here") |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 | |
create_button_template(template_name, content=None, buttons=None)
async
¶Create a message template with buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
content
|
Optional[str]
|
Message content |
None
|
buttons
|
Optional[List[Dict[str, Any]]]
|
List of button configs with keys: - label: Button text - style: "primary"/"secondary"/"success"/"danger"/"link" - custom_id: Unique ID for the button - emoji: Optional emoji - url: URL for link buttons - disabled: Boolean |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | |
create_channel(guild_id, name, channel_type='text', category_id=None, topic=None, slowmode_delay=0, nsfw=False)
async
¶Create a new channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
name
|
str
|
Channel name |
required |
channel_type
|
str
|
'text', 'voice', 'category', 'stage' |
'text'
|
category_id
|
Optional[int]
|
Parent category ID |
None
|
topic
|
Optional[str]
|
Channel topic (text channels) |
None
|
slowmode_delay
|
int
|
Slowmode in seconds |
0
|
nsfw
|
bool
|
NSFW flag |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with channel info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | |
create_embed_template(template_name, title=None, description=None, color=3447003, fields=None, footer=None, author=None, thumbnail=None, image=None, url=None)
async
¶Create a custom embed template with all options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
title
|
Optional[str]
|
Embed title (supports variables) |
None
|
description
|
Optional[str]
|
Embed description (supports variables) |
None
|
color
|
int
|
Color as hex integer |
3447003
|
fields
|
Optional[List[Dict[str, Any]]]
|
List of {"name": str, "value": str, "inline": bool} |
None
|
footer
|
Optional[str]
|
Footer text |
None
|
author
|
Optional[str]
|
Author name |
None
|
thumbnail
|
Optional[str]
|
Thumbnail URL |
None
|
image
|
Optional[str]
|
Image URL |
None
|
url
|
Optional[str]
|
Title URL |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 | |
create_invite(channel_id, max_age=86400, max_uses=0, temporary=False, unique=True, reason=None)
async
¶Create an invitation link for a channel/server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to create invite for |
required |
max_age
|
int
|
Time in seconds until invite expires (0 = never, default 86400 = 24h) |
86400
|
max_uses
|
int
|
Max number of uses (0 = unlimited) |
0
|
temporary
|
bool
|
Whether members get temporary membership |
False
|
unique
|
bool
|
Create a unique invite (if False, may return existing similar invite) |
True
|
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with invite code, URL, and settings |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | |
create_message_template(template_name, content=None, embed=None, components=None)
async
¶Create a reusable message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Unique name for the template |
required |
content
|
Optional[str]
|
Message text content |
None
|
embed
|
Optional[Dict[str, Any]]
|
Embed configuration dict |
None
|
components
|
Optional[List[Dict[str, Any]]]
|
List of components (buttons, select menus) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 | |
create_poll_template(template_name='poll', question='{question}', options=None)
async
¶Create a poll template with reaction options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'poll'
|
question
|
str
|
Poll question with variables |
'{question}'
|
options
|
Optional[List[str]]
|
List of poll options (max 10) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 | |
create_select_menu_template(template_name, content=None, placeholder='Select an option', options=None, min_values=1, max_values=1)
async
¶Create a message template with a select menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
content
|
Optional[str]
|
Message content |
None
|
placeholder
|
str
|
Placeholder text |
'Select an option'
|
options
|
Optional[List[Dict[str, Any]]]
|
List of option configs with keys: - label: Option label - value: Option value - description: Optional description - emoji: Optional emoji |
None
|
min_values
|
int
|
Minimum selections |
1
|
max_values
|
int
|
Maximum selections |
1
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 | |
create_server(name, icon=None, region=None)
async
¶Create a new Discord server (guild).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Server name |
required |
icon
|
Optional[str]
|
Optional base64 encoded icon |
None
|
region
|
Optional[str]
|
Optional voice region |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with server info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | |
create_thread(channel_id, name, message_id=None, auto_archive_duration=1440)
async
¶Create a thread in a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
str
|
Thread name |
required |
message_id
|
Optional[int]
|
Message to create thread from (optional) |
None
|
auto_archive_duration
|
int
|
Auto-archive in minutes (60, 1440, 4320, 10080) |
1440
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with thread info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | |
create_webhook(channel_id, name, avatar=None)
async
¶Create a webhook.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
str
|
Webhook name |
required |
avatar
|
Optional[bytes]
|
Optional avatar bytes |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with webhook info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | |
create_welcome_template(template_name='welcome', title='Welcome to {server_name}!', description="Hey {username}, welcome to our server! We're glad to have you here.", color=65280, thumbnail=None, image=None, fields=None)
async
¶Create a welcome message template with common variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
'welcome'
|
title
|
str
|
Title with variables like {username}, {server_name}, {member_count} |
'Welcome to {server_name}!'
|
description
|
str
|
Description text with variables |
"Hey {username}, welcome to our server! We're glad to have you here."
|
color
|
int
|
Embed color (hex) |
65280
|
thumbnail
|
Optional[str]
|
Thumbnail URL |
None
|
image
|
Optional[str]
|
Image URL |
None
|
fields
|
Optional[List[Dict[str, Any]]]
|
List of embed fields |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 | |
delete_channel(channel_id, reason=None)
async
¶Delete a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | |
delete_invite(invite_code, reason=None)
async
¶Delete/revoke an invite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invite_code
|
str
|
Invite code (not full URL, just the code part) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | |
delete_message(channel_id, message_id, delay=0)
async
¶Delete a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to delete |
required |
delay
|
float
|
Optional delay in seconds before deletion |
0
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
delete_message_template(template_name)
async
¶Delete a message template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 | |
delete_server(guild_id)
async
¶Delete a Discord server (only if bot is owner).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to delete |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | |
disconnect_member(guild_id, user_id)
async
¶Disconnect member from voice channel.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | |
edit_channel(channel_id, name=None, topic=None, slowmode_delay=None, nsfw=None, position=None)
async
¶Edit channel settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
name
|
Optional[str]
|
New name |
None
|
topic
|
Optional[str]
|
New topic |
None
|
slowmode_delay
|
Optional[int]
|
Slowmode seconds |
None
|
nsfw
|
Optional[bool]
|
NSFW flag |
None
|
position
|
Optional[int]
|
Channel position |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | |
edit_message(channel_id, message_id, new_content=None, new_embed=None)
async
¶Edit an existing message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to edit |
required |
new_content
|
Optional[str]
|
New message content (optional) |
None
|
new_embed
|
Optional[Dict[str, Any]]
|
New embed dict (optional) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and edited message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
edit_server(guild_id, name=None, icon=None, description=None, verification_level=None)
async
¶Edit server settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
name
|
Optional[str]
|
New server name |
None
|
icon
|
Optional[str]
|
New icon (base64) |
None
|
description
|
Optional[str]
|
New description |
None
|
verification_level
|
Optional[int]
|
Verification level (0-4) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
export_to_agent()
async
¶Export all Discord tools to the agent with categories and flags
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | |
get_bot_status()
async
¶Get current bot status and statistics.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with bot status information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | |
get_channel_info(channel_id)
async
¶Get information about a Discord channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with channel information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_invite_info(invite_code)
async
¶Get information about an invite without joining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invite_code
|
str
|
Invite code |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with invite information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | |
get_invites(guild_id)
async
¶Get all invites for a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of invite info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 | |
get_kernel_metrics()
async
¶Get kernel performance metrics.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with kernel metrics |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | |
get_member_roles(guild_id, user_id)
async
¶Get all roles of a member in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of role info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | |
get_message(channel_id, message_id)
async
¶Get information about a specific message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to fetch |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with message information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
get_message_reactions(channel_id, message_id, emoji=None)
async
¶Get reactions from a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where the message is |
required |
message_id
|
int
|
Message ID |
required |
emoji
|
Optional[str]
|
Optional specific emoji to get reactions for (e.g., "👍", "custom_emoji_name") |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with reaction data |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
get_message_template(template_name)
async
¶Get a message template by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Template name |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with template data |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | |
get_recent_messages(channel_id, limit=10, before=None, after=None)
async
¶Get recent messages from a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to fetch messages from |
required |
limit
|
int
|
Maximum number of messages to fetch (default 10, max 100) |
10
|
before
|
Optional[int]
|
Fetch messages before this message ID |
None
|
after
|
Optional[int]
|
Fetch messages after this message ID |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of message info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
get_server_info(guild_id=None)
async
¶Get information about a Discord server (guild).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
Optional[int]
|
Optional guild ID. If None, returns info for all guilds. |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with server information including name, member count, channels, roles, etc. |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
get_template_examples()
async
¶Get practical template examples for common scenarios.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with ready-to-use template examples showing tool usage |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 | |
get_template_help()
async
¶Get comprehensive help on creating and using message templates.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with detailed template documentation and examples |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 | |
get_tools_overview()
async
¶Get overview of all available Discord tools organized by category.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with categorized tool information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 | |
get_user_info(user_id, guild_id=None)
async
¶Get information about a Discord user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
User ID |
required |
guild_id
|
Optional[int]
|
Optional guild ID for member-specific info |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with user information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
get_voice_status(guild_id)
async
¶Get voice connection status for a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to check |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with voice status information |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
join_thread(thread_id)
async
¶Join a thread.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | |
join_voice_channel(channel_id)
async
¶Join a voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Voice channel ID to join |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and voice client info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
kick_member(guild_id, user_id, reason=None)
async
¶Kick a member from the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to kick |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | |
leave_thread(thread_id)
async
¶Leave a thread.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 | |
leave_voice_channel(guild_id)
async
¶Leave the current voice channel in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID to leave voice channel from |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
list_channels(guild_id, channel_type=None)
async
¶List all channels in a guild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
channel_type
|
Optional[str]
|
Optional filter by type ('text', 'voice', 'category', 'stage') |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of channel info dicts |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
list_message_templates()
async
¶List all available message templates.
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of template names and info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | |
move_member(guild_id, user_id, channel_id)
async
¶Move member to different voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
channel_id
|
int
|
Target voice channel ID |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 | |
remove_reaction(channel_id, message_id, emoji, user_id=None)
async
¶Remove a reaction from a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID where message is located |
required |
message_id
|
int
|
Message ID to remove reaction from |
required |
emoji
|
str
|
Emoji to remove |
required |
user_id
|
Optional[int]
|
Optional user ID (if None, removes bot's reaction) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
remove_role(guild_id, user_id, role_id, reason=None)
async
¶Remove a role from a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
role_id
|
int
|
Role ID to remove |
required |
reason
|
Optional[str]
|
Optional reason for audit log |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
remove_timeout(guild_id, user_id, reason=None)
async
¶Remove timeout from member.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | |
send_dm(user_id, content, embed=None)
async
¶Send a DM to a user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
User ID |
required |
content
|
str
|
Message content |
required |
embed
|
Optional[Dict[str, Any]]
|
Optional embed dict |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 | |
send_file(channel_id, file_path, filename=None, content=None)
async
¶Send a file to a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
file_path
|
str
|
Path to file |
required |
filename
|
Optional[str]
|
Optional filename override |
None
|
content
|
Optional[str]
|
Optional message content |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | |
send_message(channel_id, content, embed=None, reply_to=None)
async
¶Send a message to a Discord channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to send message to |
required |
content
|
str
|
Message content (text) |
required |
embed
|
Optional[Dict[str, Any]]
|
Optional embed dict with title, description, color, fields |
None
|
reply_to
|
Optional[int]
|
Optional message ID to reply to |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with sent message info (id, channel_id, timestamp) |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
send_template_message(channel_id, template_name, variables=None, reply_to=None)
async
¶Send a message using a template with variable substitution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID to send to |
required |
template_name
|
str
|
Template name |
required |
variables
|
Optional[Dict[str, str]]
|
Dict of variables to substitute (e.g., {"username": "John", "points": "100"}) |
None
|
reply_to
|
Optional[int]
|
Optional message ID to reply to |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with sent message info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | |
send_tts_message(guild_id, text, mode=None)
async
¶Send a TTS (Text-to-Speech) message in the current voice channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID where the bot is in a voice channel |
required |
text
|
str
|
Text to speak via TTS |
required |
mode
|
Optional[str]
|
TTS mode ('elevenlabs' or 'piper', defaults to current mode) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status and TTS info |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
set_bot_status(status='online', activity_type='playing', activity_name=None)
async
¶Set bot's Discord status and activity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
str
|
Status ('online', 'idle', 'dnd', 'invisible') |
'online'
|
activity_type
|
str
|
Activity type ('playing', 'watching', 'listening', 'streaming') |
'playing'
|
activity_name
|
Optional[str]
|
Activity name/text |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
set_channel_permissions(channel_id, target_id, target_type, allow=None, deny=None, reason=None)
async
¶Set channel permissions for role or member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int
|
Channel ID |
required |
target_id
|
int
|
Role or member ID |
required |
target_type
|
str
|
'role' or 'member' |
required |
allow
|
Optional[int]
|
Permissions to allow (bitfield) |
None
|
deny
|
Optional[int]
|
Permissions to deny (bitfield) |
None
|
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 | |
timeout_member(guild_id, user_id, duration_minutes, reason=None)
async
¶Timeout (mute) a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID |
required |
duration_minutes
|
int
|
Timeout duration in minutes (max 40320 = 28 days) |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | |
toggle_tts(guild_id, mode=None)
async
¶Toggle TTS (Text-to-Speech) on/off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
mode
|
Optional[str]
|
TTS mode ('elevenlabs', 'piper', 'off', or None to toggle) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with TTS status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | |
unban_member(guild_id, user_id, reason=None)
async
¶Unban a member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guild_id
|
int
|
Guild ID |
required |
user_id
|
int
|
User ID to unban |
required |
reason
|
Optional[str]
|
Audit log reason |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with success status |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/discord_tools.py
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | |
obsidian_tools
¶Obsidian Tools for Discord/Telegram Kernels¶
Quick-access tools that wrap the Obsidian MCP Server for use in chat interfaces.
ObsidianKernelTools
¶High-level tools for Discord/Telegram kernel integration.
Provides simple commands like: - /capture [text] -> Daily note - /note [title][content] -> New note - /search [query] -> Search vault - /link [from][to] -> Create link
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
capture(text, section='Notes', tags=None)
async
¶Quick capture to today's daily note.
Usage: /capture This is my idea #project #important
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
create_link(from_path, to_path)
async
¶Create link between notes.
Usage: /link Projects/A.md Projects/B.md
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
245 246 247 248 249 250 251 252 253 254 255 | |
create_note(title, content='', folder='Inbox', tags=None, template=None)
async
¶Create a new note.
Usage: /note "My Project" "Initial ideas for the project" folder=Projects
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
get_daily(date_str=None)
async
¶Get or create daily note.
Usage: /daily or /daily 2024-01-15
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
get_graph_stats()
async
¶Get vault graph statistics.
Usage: /graph
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get_related(path)
async
¶Get related notes (links + backlinks).
Usage: /related Projects/MyProject.md
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
get_tools_for_agent()
¶Get tool definitions for agent registration
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
read_note(path)
async
¶Read a note.
Usage: /read Projects/MyProject.md
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
search(query, limit=5)
async
¶Search notes by text.
Usage: /search python async
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
search_tag(tag)
async
¶Find notes by tag.
Usage: /tag project
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/obsidian_tools.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
whatsapp_tools
¶WhatsApp Advanced Tools for ProA Kernel Version: 1.0.0
Bietet dem Agenten Werkzeuge für interaktive Nachrichten, Kontaktmanagement und Gruppen-Funktionen (Broadcasts).
WhatsAppKernelTools
¶WhatsApp-spezifische Tools für die Agenten-Integration
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
add_to_broadcast(list_name, user_id)
async
¶Fügt User zur Liste hinzu
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
117 118 119 120 121 122 123 124 125 | |
create_broadcast_list(name, user_ids)
async
¶Erstellt eine neue Broadcast-Liste (Simulierte Gruppe)
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
112 113 114 115 | |
export_to_agent()
async
¶Exportiert die Tools zum Agenten
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
mark_as_read(message_id)
async
¶Markiert eine Nachricht explizit als gelesen
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
164 165 166 167 168 169 170 | |
send_broadcast(list_name, content, is_interactive=False)
async
¶Sendet eine Nachricht an alle in der Liste.
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
send_buttons(user_id, text, buttons, header=None, footer=None)
async
¶Sendet eine Nachricht mit bis zu 3 Buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
Telefonnummer des Empfängers |
required |
text
|
str
|
Nachrichtentext |
required |
buttons
|
List[Dict[str, str]]
|
Liste von Dictionaries [{"id": "yes_btn", "title": "Ja"}, ...] |
required |
header
|
Optional[str]
|
Optionaler Header-Text |
None
|
footer
|
Optional[str]
|
Optionaler Footer-Text |
None
|
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
send_contact(user_id, contact_name, contact_phone)
async
¶Sendet eine vCard / Kontaktkarte
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
151 152 153 154 155 156 157 158 159 160 161 162 | |
send_menu_list(user_id, text, button_text, sections, title='Menü')
async
¶Sendet ein Listen-Menü (bis zu 10 Optionen).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sections
|
List[Dict[str, Any]]
|
Liste von Sektionen [{"title": "Sektion 1", "rows": [{"id": "1", "title": "Option A", "description": "Details"}]}] |
required |
Source code in toolboxv2/mods/isaa/kernel/kernelin/tools/whatsapp_tools.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
models
¶
ProA Kernel - Advanced Implementation with Learning & Scheduling Version: 2.0.0
Extended implementation with: - Memory injection and learning from interactions - WebSocket and advanced output routers - Task scheduling for user and agent - Preference learning system - Agent integration layer with exported functions
AgentIntegrationLayer
¶
Provides exported functions for the agent to interact with kernel
Source code in toolboxv2/mods/isaa/kernel/models.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | |
ask_user(question, timeout=300.0)
async
¶Ask user a question and wait for response
Example
answer = await ask_user( "Which option do you prefer: A or B?", timeout=60.0 )
Source code in toolboxv2/mods/isaa/kernel/models.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | |
get_user_preferences()
async
¶Get current user's learned preferences
Example
prefs = await get_user_preferences() style = prefs.get('communication_style')
Source code in toolboxv2/mods/isaa/kernel/models.py
983 984 985 986 987 988 989 990 991 992 993 | |
inject_memory(content, memory_type='fact', importance=0.5, tags=None)
async
¶Inject a memory for current user
Example
memory_id = await inject_memory( "User prefers concise responses", memory_type="preference", importance=0.8 )
Source code in toolboxv2/mods/isaa/kernel/models.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | |
record_feedback(feedback, score)
async
¶Record feedback for learning
Example
await record_feedback("Response was too long", -0.5)
Source code in toolboxv2/mods/isaa/kernel/models.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | |
schedule_task(task_type, content, delay_seconds=None, scheduled_time=None, priority=5)
async
¶Schedule a task (callable by agent)
Example
task_id = await schedule_task( "reminder", "Follow up on project X", delay_seconds=3600 )
Source code in toolboxv2/mods/isaa/kernel/models.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | |
send_intermediate_response(content, stage='processing')
async
¶Send intermediate response while processing
Example
await send_intermediate_response( "Analyzing data...", stage="analysis" )
Source code in toolboxv2/mods/isaa/kernel/models.py
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
ContextStore
¶
Speichert System-Events und deren Ergebnisse für den Agent-Kontext
Source code in toolboxv2/mods/isaa/kernel/models.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
clear_old_events(max_age_seconds=3600)
¶Clear events older than max_age
Source code in toolboxv2/mods/isaa/kernel/models.py
70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_event(event_id)
¶Get an event result
Source code in toolboxv2/mods/isaa/kernel/models.py
54 55 56 57 58 59 | |
get_recent_events(limit=10)
¶Get recent events sorted by timestamp
Source code in toolboxv2/mods/isaa/kernel/models.py
61 62 63 64 65 66 67 68 | |
store_event(event_id, data)
¶Store an event result
Source code in toolboxv2/mods/isaa/kernel/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
LearningEngine
¶
Learning system that analyzes interactions and adapts behavior
Source code in toolboxv2/mods/isaa/kernel/models.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
analyze_and_learn(user_id)
async
¶Analyze interactions and update preferences
Source code in toolboxv2/mods/isaa/kernel/models.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
apply_preferences_to_query(user_id, query)
async
¶Apply learned preferences to modify query or execution
Returns:
| Type | Description |
|---|---|
tuple[str, dict]
|
(modified_query, execution_hints) |
Source code in toolboxv2/mods/isaa/kernel/models.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
get_preferences(user_id)
¶Get user preferences
Source code in toolboxv2/mods/isaa/kernel/models.py
262 263 264 265 266 | |
record_interaction(user_id, interaction_type, content, context=None, outcome=None, feedback_score=None)
async
¶Record an interaction for learning
Source code in toolboxv2/mods/isaa/kernel/models.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
MemoryStore
¶
Advanced memory system for injecting context
Source code in toolboxv2/mods/isaa/kernel/models.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
format_memories_for_context(memories)
¶Format memories for LLM context
Source code in toolboxv2/mods/isaa/kernel/models.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
get_relevant_memories(user_id, query=None, limit=10, min_importance=0.3)
async
¶Get relevant memories for context
Source code in toolboxv2/mods/isaa/kernel/models.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
inject_memory(user_id, memory_type, content, metadata=None, importance=0.5, tags=None)
async
¶Inject a new memory
Source code in toolboxv2/mods/isaa/kernel/models.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
MultiChannelRouter
¶
Bases: IOutputRouter
Route to multiple channels (console, websocket, etc.)
Source code in toolboxv2/mods/isaa/kernel/models.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | |
add_router(router)
¶Add a router
Source code in toolboxv2/mods/isaa/kernel/models.py
814 815 816 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Send notification via all routers
Source code in toolboxv2/mods/isaa/kernel/models.py
832 833 834 835 836 837 838 839 840 841 842 843 844 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Send via all routers
Source code in toolboxv2/mods/isaa/kernel/models.py
818 819 820 821 822 823 824 825 826 827 828 829 830 | |
ProactiveActionTracker
¶
Tracks proactive actions to enforce rate limits
Source code in toolboxv2/mods/isaa/kernel/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
get_recent_count(window_seconds=3600)
¶Get count of recent proactive actions
Source code in toolboxv2/mods/isaa/kernel/models.py
104 105 106 107 108 | |
get_time_since_last()
¶Get seconds since last proactive action
Source code in toolboxv2/mods/isaa/kernel/models.py
110 111 112 113 114 | |
record_action(action_type='notification')
¶Record a proactive action
Source code in toolboxv2/mods/isaa/kernel/models.py
94 95 96 97 98 99 100 101 102 | |
TaskScheduler
¶
Advanced task scheduler for user and agent tasks
Source code in toolboxv2/mods/isaa/kernel/models.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
cancel_task(task_id)
async
¶Cancel a scheduled task
Source code in toolboxv2/mods/isaa/kernel/models.py
533 534 535 536 537 538 539 540 | |
get_user_tasks(user_id, status=None)
¶Get tasks for a user
Source code in toolboxv2/mods/isaa/kernel/models.py
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
schedule_task(user_id, task_type, content, scheduled_time=None, delay_seconds=None, priority=5, recurrence=None, metadata=None)
async
¶Schedule a task for execution with validation
Source code in toolboxv2/mods/isaa/kernel/models.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
start()
async
¶Start the scheduler
Source code in toolboxv2/mods/isaa/kernel/models.py
460 461 462 463 464 | |
stop()
async
¶Stop the scheduler
Source code in toolboxv2/mods/isaa/kernel/models.py
466 467 468 469 470 471 472 473 474 475 | |
WebSocketOutputRouter
¶
Bases: IOutputRouter
WebSocket-based output router
Source code in toolboxv2/mods/isaa/kernel/models.py
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
register_connection(user_id, websocket)
¶Register a WebSocket connection
Source code in toolboxv2/mods/isaa/kernel/models.py
695 696 697 698 699 | |
send_intermediate_response(user_id, content, stage='processing')
async
¶Send intermediate status update
Source code in toolboxv2/mods/isaa/kernel/models.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Send notification via WebSocket with fallback
Source code in toolboxv2/mods/isaa/kernel/models.py
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Send response via WebSocket
Source code in toolboxv2/mods/isaa/kernel/models.py
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
unregister_connection(user_id)
¶Unregister a WebSocket connection
Source code in toolboxv2/mods/isaa/kernel/models.py
718 719 720 721 722 | |
types
¶
ProA Kernel - Proactive Autonomous Kernel Version: 1.0.0
Transforms the FlowAgent from a reactive tool into a persistent, event-driven, always-on companion with proactive capabilities.
ConsoleOutputRouter
¶
Bases: IOutputRouter
Simple console-based output router for testing
Source code in toolboxv2/mods/isaa/kernel/types.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶Send notification to console
Source code in toolboxv2/mods/isaa/kernel/types.py
521 522 523 524 525 526 527 528 529 530 531 | |
send_response(user_id, content, role='assistant', metadata=None)
async
¶Send response to console
Source code in toolboxv2/mods/isaa/kernel/types.py
510 511 512 513 514 515 516 517 518 519 | |
DefaultDecisionEngine
¶
Bases: IDecisionEngine
Default implementation of proactivity decision logic
Source code in toolboxv2/mods/isaa/kernel/types.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
evaluate_proactivity(context)
async
¶Evaluate if proactive action is needed
Source code in toolboxv2/mods/isaa/kernel/types.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
should_interrupt_user(signal, user_state)
async
¶Quick interrupt check
Source code in toolboxv2/mods/isaa/kernel/types.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
IDecisionEngine
¶
Bases: ABC
Abstract interface for proactivity decision making
Source code in toolboxv2/mods/isaa/kernel/types.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
evaluate_proactivity(context)
abstractmethod
async
¶Decide if and how to handle a signal proactively
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ProactivityContext
|
Context containing signal, user state, and history |
required |
Returns:
| Type | Description |
|---|---|
ProactivityDecision
|
ProactivityDecision indicating how to handle the signal |
Source code in toolboxv2/mods/isaa/kernel/types.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
should_interrupt_user(signal, user_state)
abstractmethod
async
¶Quick check if user should be interrupted
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Signal
|
The signal to potentially interrupt with |
required |
user_state
|
UserState
|
Current user state |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if interruption is warranted |
Source code in toolboxv2/mods/isaa/kernel/types.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
IOutputRouter
¶
Bases: ABC
Abstract interface for routing agent outputs
Source code in toolboxv2/mods/isaa/kernel/types.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
send_notification(user_id, content, priority=5, metadata=None)
abstractmethod
async
¶Send a proactive notification
Source code in toolboxv2/mods/isaa/kernel/types.py
495 496 497 498 499 500 501 502 503 504 | |
send_response(user_id, content, role='assistant', metadata=None)
abstractmethod
async
¶Send a response to the user
Source code in toolboxv2/mods/isaa/kernel/types.py
484 485 486 487 488 489 490 491 492 493 | |
IProAKernel
¶
Bases: ABC
Abstract interface for the ProA Kernel
The kernel wraps the FlowAgent and provides: - Event-driven architecture - Proactive capabilities - User state awareness - Signal prioritization - Always-on lifecycle
Source code in toolboxv2/mods/isaa/kernel/types.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
get_status()
abstractmethod
¶Get kernel status and metrics
Source code in toolboxv2/mods/isaa/kernel/types.py
461 462 463 464 | |
handle_user_input(user_id, content, metadata=None)
abstractmethod
async
¶Handle direct user input
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
User identifier |
required |
content
|
str
|
User's input text |
required |
metadata
|
dict
|
Optional metadata (voice flags, etc.) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Agent's response |
Source code in toolboxv2/mods/isaa/kernel/types.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
set_do_not_disturb(user_id, enabled)
abstractmethod
async
¶Enable/disable do-not-disturb mode
Source code in toolboxv2/mods/isaa/kernel/types.py
456 457 458 459 | |
set_user_location(user_id, location)
abstractmethod
async
¶Update user's interface location (web, mobile, etc.)
Source code in toolboxv2/mods/isaa/kernel/types.py
451 452 453 454 | |
start()
abstractmethod
async
¶Start the kernel lifecycle loop
Source code in toolboxv2/mods/isaa/kernel/types.py
402 403 404 405 | |
stop()
abstractmethod
async
¶Stop the kernel gracefully
Source code in toolboxv2/mods/isaa/kernel/types.py
407 408 409 410 | |
trigger_event(event_name, payload, priority=5, source='external')
abstractmethod
async
¶Trigger a system event
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_name
|
str
|
Name of the event |
required |
payload
|
dict
|
Event data |
required |
priority
|
int
|
Event priority (0-10) |
5
|
source
|
str
|
Event source identifier |
'external'
|
Source code in toolboxv2/mods/isaa/kernel/types.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
ISignalBus
¶
Bases: ABC
Abstract interface for signal ingestion and routing
Source code in toolboxv2/mods/isaa/kernel/types.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
emit_signal(signal)
abstractmethod
async
¶Emit a signal into the kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
306 307 308 309 | |
get_next_signal(timeout=None)
abstractmethod
async
¶Get next prioritized signal
Source code in toolboxv2/mods/isaa/kernel/types.py
311 312 313 314 | |
get_queue_size()
abstractmethod
¶Get current queue size
Source code in toolboxv2/mods/isaa/kernel/types.py
316 317 318 319 | |
IStateMonitor
¶
Bases: ABC
Abstract interface for monitoring user and system state
Source code in toolboxv2/mods/isaa/kernel/types.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
get_user_state(user_id)
abstractmethod
async
¶Get current user state
Source code in toolboxv2/mods/isaa/kernel/types.py
233 234 235 236 | |
set_do_not_disturb(user_id, enabled)
abstractmethod
async
¶Set do-not-disturb mode
Source code in toolboxv2/mods/isaa/kernel/types.py
252 253 254 255 | |
set_user_location(user_id, location)
abstractmethod
async
¶Update user's current interface location
Source code in toolboxv2/mods/isaa/kernel/types.py
247 248 249 250 | |
update_user_activity(user_id, activity='input')
abstractmethod
async
¶Record user activity
Source code in toolboxv2/mods/isaa/kernel/types.py
238 239 240 241 242 243 244 245 | |
InteractionType
¶
Bases: Enum
Types of interactions to learn from
Source code in toolboxv2/mods/isaa/kernel/types.py
584 585 586 587 588 589 590 591 | |
KernelConfig
dataclass
¶
Configuration for ProA Kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
KernelMetrics
dataclass
¶
Metrics for kernel operation
Source code in toolboxv2/mods/isaa/kernel/types.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
get_uptime()
¶Get kernel uptime in seconds
Source code in toolboxv2/mods/isaa/kernel/types.py
554 555 556 | |
to_dict()
¶Convert to dictionary
Source code in toolboxv2/mods/isaa/kernel/types.py
558 559 560 561 562 563 564 565 566 567 568 | |
update_response_time(response_time)
¶Update average response time
Source code in toolboxv2/mods/isaa/kernel/types.py
547 548 549 550 551 552 | |
KernelState
¶
Bases: Enum
Possible kernel states
Source code in toolboxv2/mods/isaa/kernel/types.py
469 470 471 472 473 474 475 476 | |
LearningRecord
¶
Bases: BaseModel
Pydantic model for learning records
Source code in toolboxv2/mods/isaa/kernel/types.py
594 595 596 597 598 599 600 601 602 603 | |
Memory
¶
Bases: BaseModel
Individual memory item
Source code in toolboxv2/mods/isaa/kernel/types.py
632 633 634 635 636 637 638 639 640 641 642 643 | |
MemoryType
¶
Bases: Enum
Types of memories
Source code in toolboxv2/mods/isaa/kernel/types.py
623 624 625 626 627 628 629 | |
ProactivityContext
dataclass
¶
Context for making proactivity decisions
Source code in toolboxv2/mods/isaa/kernel/types.py
100 101 102 103 104 105 106 107 | |
ProactivityDecision
¶
Bases: Enum
Possible proactivity decisions
Source code in toolboxv2/mods/isaa/kernel/types.py
110 111 112 113 114 115 | |
ScheduledTask
¶
Bases: BaseModel
Model for scheduled tasks
Source code in toolboxv2/mods/isaa/kernel/types.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
Signal
dataclass
¶
Unified signal structure for all kernel inputs
Source code in toolboxv2/mods/isaa/kernel/types.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
__lt__(other)
¶Enable priority queue sorting (higher priority first)
Source code in toolboxv2/mods/isaa/kernel/types.py
45 46 47 | |
SignalBus
¶
Bases: ISignalBus
Implementation of signal bus with priority queue
Source code in toolboxv2/mods/isaa/kernel/types.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
emit_signal(signal)
async
¶Emit a signal into the kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
329 330 331 332 333 334 335 336 337 338 339 340 341 | |
get_next_signal(timeout=None)
async
¶Get next prioritized signal
Source code in toolboxv2/mods/isaa/kernel/types.py
343 344 345 346 347 348 349 350 351 352 353 354 | |
get_queue_size()
¶Get current queue size
Source code in toolboxv2/mods/isaa/kernel/types.py
356 357 358 | |
get_signal_history()
¶Get recent signal history
Source code in toolboxv2/mods/isaa/kernel/types.py
360 361 362 | |
SignalType
¶
Bases: Enum
Types of signals that can be processed by the kernel
Source code in toolboxv2/mods/isaa/kernel/types.py
23 24 25 26 27 28 29 30 31 | |
StateMonitor
¶
Bases: IStateMonitor
Implementation of state monitoring
Source code in toolboxv2/mods/isaa/kernel/types.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_context(user_id)
¶Get full user context
Source code in toolboxv2/mods/isaa/kernel/types.py
296 297 298 | |
get_user_state(user_id)
async
¶Get current user state
Source code in toolboxv2/mods/isaa/kernel/types.py
270 271 272 273 274 | |
set_do_not_disturb(user_id, enabled)
async
¶Set do-not-disturb mode
Source code in toolboxv2/mods/isaa/kernel/types.py
290 291 292 293 294 | |
set_user_location(user_id, location)
async
¶Update user's interface location
Source code in toolboxv2/mods/isaa/kernel/types.py
285 286 287 288 | |
update_user_activity(user_id, activity='input')
async
¶Record user activity
Source code in toolboxv2/mods/isaa/kernel/types.py
276 277 278 279 280 281 282 283 | |
TaskStatus
¶
Bases: Enum
Status of scheduled tasks
Source code in toolboxv2/mods/isaa/kernel/types.py
648 649 650 651 652 653 654 | |
UserContext
dataclass
¶
Track user state and context
Source code in toolboxv2/mods/isaa/kernel/types.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
get_idle_time()
¶Get seconds since last interaction
Source code in toolboxv2/mods/isaa/kernel/types.py
80 81 82 | |
update_interaction(activity='input')
¶Record user interaction
Source code in toolboxv2/mods/isaa/kernel/types.py
70 71 72 73 74 75 76 77 78 | |
update_state()
¶Update state based on idle time
Source code in toolboxv2/mods/isaa/kernel/types.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
UserPreferences
¶
Bases: BaseModel
Learned user preferences
Source code in toolboxv2/mods/isaa/kernel/types.py
606 607 608 609 610 611 612 613 614 615 616 617 | |
UserState
¶
Bases: Enum
Possible states of user engagement
Source code in toolboxv2/mods/isaa/kernel/types.py
52 53 54 55 56 57 | |
module
¶
ISAA Module - Refactored V2
Changes from V1: - Removed ToolsInterface (obsolete) - Added native Chain support with helper methods - Added Agent Export/Import system (.tar.gz with dill serialization) - Cleaned up unused code - Preserved all existing APIs (mini_task_completion, format_class, etc.)
Author: FlowAgent V2
AgentExportManifest
¶
Bases: BaseModel
Manifest file for exported agent archive
Source code in toolboxv2/mods/isaa/module.py
215 216 217 218 219 220 221 222 223 224 225 226 227 | |
AgentNetworkManifest
¶
Bases: BaseModel
Manifest for multi-agent network export
Source code in toolboxv2/mods/isaa/module.py
230 231 232 233 234 235 236 | |
ToolSerializationError
¶
Bases: Exception
Raised when a tool cannot be serialized
Source code in toolboxv2/mods/isaa/module.py
126 127 128 | |
ToolSerializationInfo
¶
Bases: BaseModel
Information about a tool's serialization status
Source code in toolboxv2/mods/isaa/module.py
131 132 133 134 135 136 137 138 | |
Tools
¶
Bases: MainTool
Source code in toolboxv2/mods/isaa/module.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | |
add_langchain_tools_to_builder(tools_config, agent_builder)
async
¶
Initialize tools from config (legacy compatibility)
Source code in toolboxv2/mods/isaa/module.py
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | |
chain_from_agents(*agent_names)
¶
Create a chain from agent names (will be resolved on execution).
Usage
chain = isaa.chain_from_agents("analyzer", "summarizer", "formatter")
Source code in toolboxv2/mods/isaa/module.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
create_chain(*agents_or_components)
¶
Create a Chain from agents and/or components.
Usage
Simple sequential chain¶
chain = isaa.create_chain(agent1, agent2, agent3)
With formatting¶
chain = isaa.create_chain(agent1, CF(MyModel), agent2)
With conditions¶
chain = isaa.create_chain(agent1, IS("key", "value"), agent2)
Mixed with functions¶
chain = isaa.create_chain(agent1, lambda x: x.upper(), agent2)
Returns:
| Type | Description |
|---|---|
Chain
|
Chain object ready for execution |
Source code in toolboxv2/mods/isaa/module.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
deserialize_all(data)
¶
Load agent configurations
Source code in toolboxv2/mods/isaa/module.py
944 945 946 947 948 | |
export_agent_network(agent_names, path, entry_agent=None, include_checkpoints=True, include_tools=True)
async
¶
Export multiple connected agents as a network archive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_names
|
list[str]
|
List of agent names to export |
required |
path
|
str
|
Output path for the network archive |
required |
entry_agent
|
str | None
|
Optional entry point agent name |
None
|
include_checkpoints
|
bool
|
Include checkpoints for all agents |
True
|
include_tools
|
bool
|
Include tool serialization |
True
|
Returns:
| Type | Description |
|---|---|
tuple[bool, str]
|
Tuple of (success, message) |
Source code in toolboxv2/mods/isaa/module.py
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
get_augment()
¶
Get augmented data for serialization (legacy compatibility)
Source code in toolboxv2/mods/isaa/module.py
896 897 898 899 900 | |
import_agent_network(path, name_prefix='', restore_bindings=True)
async
¶
Import a network of agents from an archive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the network archive |
required |
name_prefix
|
str
|
Optional prefix for all agent names |
''
|
restore_bindings
|
bool
|
Restore agent-to-agent bindings |
True
|
Returns:
| Type | Description |
|---|---|
tuple[dict[str, FlowAgent], list[str]]
|
Tuple of (dict of name->agent, list of warnings) |
Source code in toolboxv2/mods/isaa/module.py
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | |
init_from_augment(augment, agent_name='self')
async
¶
Initialize from augmented data (legacy compatibility)
Source code in toolboxv2/mods/isaa/module.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | |
load_agent(path, override_name=None, load_tools=True, register=True)
async
¶
Import an agent from a .tar.gz archive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the archive |
required |
override_name
|
str | None
|
Optional new name for the agent |
None
|
load_tools
|
bool
|
Attempt to deserialize and register tools |
True
|
register
|
bool
|
Register the agent in ISAA |
True
|
Returns:
| Type | Description |
|---|---|
tuple[FlowAgent | None, AgentExportManifest | None, list[str]]
|
Tuple of (agent or None, manifest or None, list of warnings) |
Source code in toolboxv2/mods/isaa/module.py
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
run_chain(chain, query, session_id='default', **kwargs)
async
¶
Execute a chain with the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chain
|
Chain | list
|
Chain object or list of components |
required |
query
|
str
|
Initial query/data |
required |
session_id
|
str
|
Session ID for all agents in the chain |
'default'
|
**kwargs
|
Additional arguments passed to chain execution |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
Final result from chain execution |
Source code in toolboxv2/mods/isaa/module.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
save_agent(agent_name, path, include_checkpoint=True, include_tools=True, notes=None)
async
¶
Export an agent to a .tar.gz archive.
Archive structure
agent_name.tar.gz/ ├── manifest.json # Export metadata ├── config.json # AgentConfig ├── checkpoint.json # Optional: Agent state ├── tools.dill # Optional: Serialized tools └── tools_manifest.json # Tool serialization info
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
str
|
Name of the agent to export |
required |
path
|
str
|
Output path (will add .tar.gz if not present) |
required |
include_checkpoint
|
bool
|
Include agent checkpoint/state |
True
|
include_tools
|
bool
|
Attempt to serialize tools |
True
|
notes
|
str | None
|
Optional notes to include in manifest |
None
|
Returns:
| Type | Description |
|---|---|
tuple[bool, AgentExportManifest | str]
|
Tuple of (success: bool, manifest or error_message) |
Source code in toolboxv2/mods/isaa/module.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
serialize_all()
¶
Returns a copy of agent_data
Source code in toolboxv2/mods/isaa/module.py
940 941 942 | |
registry
¶
client
¶
RegistryClient
¶
Manages the client-side connection to the Registry Server with robust reconnection and long-running support.
Source code in toolboxv2/mods/registry/client.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
cancel_execution(request_id)
async
¶
Cancel a running execution.
Source code in toolboxv2/mods/registry/client.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
cleanup_completed_executions()
async
¶
Clean up completed execution tasks.
Source code in toolboxv2/mods/registry/client.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
connect(server_url, timeout=30.0)
async
¶
Connect and start all background tasks.
Source code in toolboxv2/mods/registry/client.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
disconnect()
async
¶
Enhanced disconnect with complete task cleanup.
Source code in toolboxv2/mods/registry/client.py
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
get_connection_status()
async
¶
Get detailed connection status information.
Source code in toolboxv2/mods/registry/client.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
get_diagnostics()
async
¶
Get comprehensive diagnostic information.
Source code in toolboxv2/mods/registry/client.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
get_registered_agents()
async
¶
Get all registered agents information.
Source code in toolboxv2/mods/registry/client.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
get_running_executions()
async
¶
Get information about currently running executions.
Source code in toolboxv2/mods/registry/client.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
health_check()
async
¶
Perform a health check of the connection.
Source code in toolboxv2/mods/registry/client.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
on(event_name, handler)
¶
Register an async callback function to handle a custom event from the server.
Source code in toolboxv2/mods/registry/client.py
627 628 629 630 | |
register(agent_instance, public_name, description=None)
async
¶
Register an agent with the server.
Source code in toolboxv2/mods/registry/client.py
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | |
send_agent_status(agent_id, status, details=None)
async
¶
Send agent status updates.
Source code in toolboxv2/mods/registry/client.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | |
send_custom_event(event_name, data)
async
¶
Send a custom event with a JSON payload to the server.
Source code in toolboxv2/mods/registry/client.py
632 633 634 635 636 637 638 639 640 641 642 643 644 | |
send_ui_progress(progress_data, retry_count=3)
async
¶
Enhanced UI progress sender with retry logic.
Source code in toolboxv2/mods/registry/client.py
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
get_registry_client(app)
¶
Factory function to get a singleton RegistryClient instance.
Source code in toolboxv2/mods/registry/client.py
1266 1267 1268 1269 1270 1271 | |
demo_custom_messaging
¶
setup_chain_with_live_updates()
async
¶
Example 3: Create agent chain with live progress broadcasting
Source code in toolboxv2/mods/registry/demo_custom_messaging.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
setup_complete_agent_system(local=False)
async
¶
Vollständiges Beispiel für Agent-System mit Live-Progress.
Source code in toolboxv2/mods/registry/demo_custom_messaging.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
setup_multiple_live_agents()
async
¶
Example 4: Host multiple agents with individual live UIs
Source code in toolboxv2/mods/registry/demo_custom_messaging.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
demo_registry
¶
run_end_user_test()
async
¶
Simuliert einen externen Aufruf an die öffentliche API des Registry Servers.
Source code in toolboxv2/mods/registry/demo_registry.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
run_local_client()
async
¶
Startet die zweite toolboxv2-Instanz als lokalen Client, der einen Agenten hostet.
Source code in toolboxv2/mods/registry/demo_registry.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
run_registry_server()
async
¶
Startet die erste toolboxv2-Instanz als unseren öffentlichen Server.
Source code in toolboxv2/mods/registry/demo_registry.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
server
¶
broadcast_to_ui_clients(app, data)
async
¶
Broadcast updates to all connected UI clients.
Source code in toolboxv2/mods/registry/server.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
handle_agent_status_update(app, message)
async
¶
Handle agent status updates.
Source code in toolboxv2/mods/registry/server.py
191 192 193 194 195 196 197 198 199 200 201 | |
handle_execution_error(app, message)
async
¶
Handle execution errors.
Source code in toolboxv2/mods/registry/server.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
handle_execution_result(app, message)
async
¶
Handle execution results.
Source code in toolboxv2/mods/registry/server.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
handle_registration(app, conn_id, session, message)
async
¶
Handle agent registration.
Source code in toolboxv2/mods/registry/server.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
handle_ui_progress_update(app, message)
async
¶
Handle UI progress updates.
Source code in toolboxv2/mods/registry/server.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
on_disconnect(app, conn_id, session=None)
async
¶
Enhanced disconnect handler with comprehensive cleanup and UI notifications.
Source code in toolboxv2/mods/registry/server.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
on_message(app, conn_id, session, payload)
async
¶
Enhanced message handler with proper error handling.
Source code in toolboxv2/mods/registry/server.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
register_ui_ws_handlers(app)
¶
Register UI-specific WebSocket handlers.
Source code in toolboxv2/mods/registry/server.py
416 417 418 419 420 421 422 423 | |
register_ws_handlers(app)
¶
Register WebSocket handlers for the registry.
Source code in toolboxv2/mods/registry/server.py
406 407 408 409 410 411 412 413 | |
run(app, public_agent_id, request)
async
¶
Public API endpoint to run agents.
Source code in toolboxv2/mods/registry/server.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | |
ui(app, public_agent_id=None)
async
¶
Serve the interactive 3-panel agent UI.
Source code in toolboxv2/mods/registry/server.py
491 492 493 494 495 496 | |
ui_on_connect(app, conn_id, session)
async
¶
UI Client connection.
Source code in toolboxv2/mods/registry/server.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
ui_on_disconnect(app, conn_id, session=None)
async
¶
UI Client Disconnection.
Source code in toolboxv2/mods/registry/server.py
400 401 402 403 | |
ui_on_message(app, conn_id, session, payload)
async
¶
UI Client Message Handler.
Source code in toolboxv2/mods/registry/server.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
types
¶
AgentRegistered
¶
Bases: BaseModel
Server -> Client: Response after successful registration.
Source code in toolboxv2/mods/registry/types.py
14 15 16 17 18 19 | |
AgentRegistration
¶
Bases: BaseModel
Client -> Server: Payload to register a new agent.
Source code in toolboxv2/mods/registry/types.py
9 10 11 12 | |
ExecutionError
¶
Bases: BaseModel
Client -> Server: Reports an error during execution.
Source code in toolboxv2/mods/registry/types.py
35 36 37 38 | |
ExecutionResult
¶
Bases: BaseModel
Client -> Server: A chunk of the execution result (for streaming).
Source code in toolboxv2/mods/registry/types.py
29 30 31 32 33 | |
RunRequest
¶
Bases: BaseModel
Server -> Client: Request to execute an agent.
Source code in toolboxv2/mods/registry/types.py
21 22 23 24 25 26 27 | |
WsMessage
¶
Bases: BaseModel
A generic wrapper for all WebSocket messages.
Source code in toolboxv2/mods/registry/types.py
40 41 42 43 | |
talk
¶
Talk Module - Voice Interface for AI Agents
Features: - Kernel-based architecture with FlowAgent - Agent selection based on user login - Minimal end-to-end latency with parallel processing - Auto-detection for speech start/end - Mini-tools (delegate_to_agent, fetch_info) - non-blocking - Custom iframe UI components managed by agent - WebSocket-based real-time communication
AgentInfo
¶
Bases: BaseModel
Information about available agent
Source code in toolboxv2/mods/talk.py
86 87 88 89 90 91 92 93 | |
TalkOutputRouter
¶
Routes kernel output to WebSocket clients
Source code in toolboxv2/mods/talk.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
send_audio(audio_data, format='audio/mpeg')
async
¶
Send audio for playback
Source code in toolboxv2/mods/talk.py
146 147 148 149 150 151 152 153 154 | |
send_chunk(chunk)
async
¶
Send streaming chunk
Source code in toolboxv2/mods/talk.py
130 131 132 133 134 135 136 | |
send_notification(user_id, content, priority=5, metadata=None)
async
¶
Send notification
Source code in toolboxv2/mods/talk.py
120 121 122 123 124 125 126 127 128 | |
send_response(user_id, content, role='assistant')
async
¶
Send agent response to all connected clients
Source code in toolboxv2/mods/talk.py
111 112 113 114 115 116 117 118 | |
send_state(state)
async
¶
Send state update
Source code in toolboxv2/mods/talk.py
138 139 140 141 142 143 144 | |
send_ui_component(component)
async
¶
Send UI component update
Source code in toolboxv2/mods/talk.py
156 157 158 159 160 161 162 | |
TalkSession
¶
Bases: BaseModel
Voice conversation session with kernel integration
Source code in toolboxv2/mods/talk.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
Tools
¶
Bases: MainTool
Talk Module - Voice Interface with Kernel Integration
Source code in toolboxv2/mods/talk.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
on_exit()
¶
Cleanup
Source code in toolboxv2/mods/talk.py
239 240 241 242 243 244 | |
on_start()
¶
Initialize Talk module
Source code in toolboxv2/mods/talk.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
UIComponent
¶
Bases: BaseModel
Agent-managed UI component that can be embedded in Talk interface
Source code in toolboxv2/mods/talk.py
54 55 56 57 58 59 60 61 62 63 64 65 66 | |
create_session(self, request)
async
¶
Create or get talk session
Source code in toolboxv2/mods/talk.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
delegate_to_agent(tools_instance, app, conn_id, target_agent, task)
async
¶
Delegate task to another agent without blocking
Source code in toolboxv2/mods/talk.py
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
fetch_info_quick(tools_instance, app, conn_id, query)
async
¶
Quick info fetch without full agent reasoning
Source code in toolboxv2/mods/talk.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
get_available_agents(self, request)
async
¶
Get list of available agents for the user
Source code in toolboxv2/mods/talk.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
get_main_ui(self, request)
¶
Serves the main Talk UI
Source code in toolboxv2/mods/talk.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 | |
manage_ui_components(self, request, session_id=None)
async
¶
Manage UI components for a session
Source code in toolboxv2/mods/talk.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
process_audio_buffer(tools_instance, app, conn_id, conn_state, session_id)
async
¶
Process accumulated audio buffer
Source code in toolboxv2/mods/talk.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
process_user_input(tools_instance, app, conn_id, session_id, user_id, text)
async
¶
Process user input through kernel - minimal latency path
Source code in toolboxv2/mods/talk.py
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | |
register_talk_websocket(app, request=None)
¶
WebSocket handler for Talk interface
Source code in toolboxv2/mods/talk.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | |
toolboxv2.flows_dict(s='.py', remote=False, dir_path=None, flows_dict_=None, ui=False)
¶
Source code in toolboxv2/flows/__init__.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
toolboxv2.TBEF
¶
Automatic generated by ToolBox v = 0.1.22